Invalid socket

I am writing a code to connect to a socket.
But when I use the function MySocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); it always returns invalid socket.
I donĀ“t know why this happens.

Any light would be very appreciated.

Thanks
What error does WSAGetLastError() return?

The MSDN entry for the socket() function lists assorted error along with their likely causes.
Topic archived. No new replies allowed.