Hmm... I was using Winsock in a console (following a random tutorial I found on the internet) and so far I wanted to see if I got any errors. So I wrote all the code (that I have read):
I linked libwsock.a and ended with a single error:Code:#include <iostream> #include <windows.h> int main( void ) { WSADATA wsaDat; if( WSAStartup( ( 1, 1 ), &wsaDat ) != 0 ) { std::cout << "WSA initialization failed!"; } SOCKET socket; socket = ( AF_INET, SOCK_STREAM, 0 ); if( socket == INVALID_SOCKET ) { std::cout << "Failed to create socket!"; } SOCKADDR_IN sockAddr; sockAddr.sin_port = 50; sockAddr.sin_family = AF_INET; sockAddr.sin_addr.S_un.S_un_b.s_b1 = 127; sockAddr.sin_addr.S_un.S_un_b.s_b2 = 0; sockAddr.sin_addr.S_un.S_un_b.s_b3 = 0; sockAddr.sin_addr.S_un.S_un_b.s_b4 = 1; if( bind( socket, ( SOCKADDR* )( &sockAddr ), sizeof( sockAddr ) ) == SOCKET_ERROR ) { std::cout << "Failed to bind!"; } std::cin.get(); return 0; }
[Build Error] ["Internet.exe"] Error 1
I haven't found anything to cause that error yet. See signature for compiler etc.
- SirCrono6
P.S. Ah! Haven't seen C++ code in so long!