Unix to Winsock connections
I have a MS VC++ program that is using CSockets. Does anybody know how I would send data from a UNIX machine to my program on a PC?
I guess since MS does all the work behind the scene I don''t know what format to put my data in so that that the CSocket wrapper can handle it.
Any Ideas???
Thanks,
Andrew and Bryant
July 24, 2003 04:14 PM
Check msdn.microsoft.com.
Chances are you simply need to marshall (pack) your data into a buffer and pass that buffer to some method of a CSocket class. I can''t say for sure, I''ve never used CSocket''s myself.
Just make sure you call htonl()/htons() on your data before sending it over the wire, and ntohl()/ntohs() when getting it out.
-- jpetrie
Chances are you simply need to marshall (pack) your data into a buffer and pass that buffer to some method of a CSocket class. I can''t say for sure, I''ve never used CSocket''s myself.
Just make sure you call htonl()/htons() on your data before sending it over the wire, and ntohl()/ntohs() when getting it out.
-- jpetrie
CSocket is simply a wrapper around the send/recv calls so you would do the same with that as you would with low-level socket, be it on Windows or UNIX.
Like the anonymous chap said - just make sure you use htons/l and ntohs/l to make sure that when transmitting over the network, everything is in the correct byte order.
Maybe you''re asking a different question in which case could you post more specific questions?
Like the anonymous chap said - just make sure you use htons/l and ntohs/l to make sure that when transmitting over the network, everything is in the correct byte order.
Maybe you''re asking a different question in which case could you post more specific questions?
"Absorb what is useful, reject what is useless, and add what is specifically your own." - Lee Jun Fan
"Absorb what is useful, reject what is useless, and add what is specifically your own." - Lee Jun Fan
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement