April 13th, 2004, 12:14 PM
Can anyone help me, I'm having a little trouble connecting to a host. The host in this case is a micro-controller, and it has an IP address which I know, and I want to connect to it. I've tried WinSock, but I haven't had any success with it. The micro-controller has an IP address, but no port number. I need to be able to send commands and receive a response from the micro-controller. But first, I just want to connect to it via TCP/IP. Any information you can give me would be really appreciated. Thanks.
April 13th, 2004, 12:20 PM
Hm.. is there a winsock server running on the host ? If not, I don't see any reason why a connect will ever be successful from the client.
April 13th, 2004, 01:38 PM
It's funny you should mention that because it never crossed my mind. I've been looking into winsock for the past two days. To answer your question, no, there is no winsock server running on the micro-controller. The problem I'm having is that I haven't dealt with TCP/IP yet, so I'm not even sure where to start. I've done a search on the forum, but haven't found anything helpful so if anyone can point me in the right direction, I would really appreciate it. Thanks again.
April 13th, 2004, 01:43 PM
Sounds like the microcontroller is "socketless". You need to find out what protocols it actually expects...time to RTFM...
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code
outside of [code] ... [/code]
tags. See here
* How NOT
to post a question here
* Of course you read this
carefully before you posted
* Need homework help? Read this first
April 13th, 2004, 01:46 PM
April 13th, 2004, 02:04 PM
Manufacturere told me the micro-controller uses TCP/IP protocol. So is there no way I can connect to the micro-controller if I know the IP address only?
April 13th, 2004, 02:22 PM
Well...you should know the port number as well...
Originally posted by kodeguruguy
So is there no way I can connect to the micro-controller if I know the IP address only?
April 13th, 2004, 05:14 PM
So true. The whole point about TCP/IP (I think it's written in the protocol spec but I may be wrong) that it comes with an IP address AND a port number.
You must know the port number to be able to communicate.
April 15th, 2004, 01:34 AM
run a server is necessary if you use the socket to communicate i think .
and normally, the server is binded to its ip & port, and waiting to recv connection to it.
Waiting OFFERS from CMU, UMass, UC Davis, OSU
Mail to me
April 16th, 2004, 10:53 AM
First off, I want to say thanks to everyone for their response. I just got off the phone with the manufacturer and got the port number for this micro-controller. So now I got the IP address and the port number, so I should be able to communicate with it with Winsock right? Anyone know where I can find a simple code for reference, or any tutorials? I've never worked with Winsock before.
April 16th, 2004, 12:46 PM
I was in the same trouble about starting programming winsock, i can give you those links, they are very clear in connecting and accepting connections...in your case you only have to create a socket with the ip and port and if the server accept you, you can start sending and receiving data ...
Here are the links:
Well, one more thing: if you want to use MFC you can check the doucmentacion for the CAsyncSocket and CSocket classes, they encapsulate winsock at a higher level....
April 16th, 2004, 12:59 PM
Winsock Programmer's FAQ...
Originally posted by kodeguruguy
Anyone know where I can find a simple code for reference, or any tutorials? I've never worked with Winsock before.
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!