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.
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.
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!) 2008, 2009 In theory, there is no difference between theory and paractice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
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?
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.
Darwen.
www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.
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.
Hello:
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 ...
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....
Bookmarks