I've worked with TCP sockets before in Python. It looks pretty similar in C but I can't get anything to work. socket(AF_INET, SOCK_STREAM, 0);
returns -1, which of course indicates an error. How could I go so wrong so fast?
If you could help me with this problem, that would be nice, but it would be incredibly helpful if you could provide me with some simple, bare bones source code. It doesn't need to even do anything really, and it doesn't need to handle errors. I just need to see how to properly create a server socket, bind it, listen on it, and accept clients and how to create and connect a client socket. I can figure out all the bells and whistles on my own.
Thanks!
Have you called WSAStartup
before making any other winsock calls?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With