|
WSANOTINITIALISED A successful WSAStartup must occur before using this function.
WSAENETDOWN The network subsystem has failed.
WSAEADDRINUSE The specified address is already in use. (See the SO_REUSEADDR socket option under setsockopt.)
WSAEFAULT The name or the namelen argument is not a valid part of the user address space, the namelen argument is too small, the name argument contains incorrect address format for the associated address family, or the first two bytes of the memory block specified by name does not match the address family associated with the socket descriptor s.
WSAEINPROGRESS A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function.
WSAEINVAL The socket is already bound to an address.
WSAENOBUFS Not enough buffers available, too many connections.
WSAENOTSOCK The descriptor is not a socket.
bind 의 에러 코드 리스트 입니다.
bind 함수를 리턴값을 직접 화면에 뿌려 보시면 도움이 되실지도요.
이영섭 님이 쓰신 글 :
: 윈도우 서버 프로그램을 하나 만들어보려고 볼랜드 2010으로 연습하는데, 맨 처음에 소켓 설정하는건 되는데, 바인드하는 부분이 안되네요. 책에서는 아무런 말도 없고, 인터넷을 뒤져봐도 당연히 되는것처럼 써있어서 하루종일 헤메다가 여기 질문 올려요.
:
: 소스 첨부합니다.
:
: SOCKET ssock, csock;
: SOCKADDR_IN server_addr;
:
: if((ssock =socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
: {
: ShowMessage("생성 실패");
: return false;
: }
:
: memset(&server_addr, 0, sizeof(server_addr));
: server_addr.sin_family = AF_INET;
: server_addr.sin_addr.s_addr = htonl(INADDR_ANY);
: server_addr.sin_port = htons(3317);
:
: if(bind(ssock, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0)
: {
: ShowMessage("바인드 실패");
: return false;
:
: }
:
: 책에서 써진대로 해봤는데 바인드가 안되더라구요. 네트워크 설정이나 기타 다른 설정이 필요한가요?
: OS는 윈도우7쓰고있습니다.
|