Advertisement

sock binding on *nix vs w98

Started by August 08, 2003 11:04 AM
2 comments, last by HellCreator 21 years, 2 months ago
on server side function in main _sock_addr * sock_addr = new _sock_addr ("127.0.0.1", 10000); _sock_addr * sock_dest = new _sock_addr (); _sock * sock = new _sock (SOCK_DGRAM); sock->bind (sock_addr); this is a bind using global #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> void _sock::bind (_sock_addr * addr) { int error = ::bind (sd, reinterpret_cast (addr->get_addr()), sizeof (struct sockaddr_in)); if(error == -1)throw _sock_exception ("_socket::bind - could not bind socket to a provided name"); } On my Bamboo(mdk 9.1) it wont work error after bind called says: name already in use I havn''t documentation on sok programming with linux Equ code on w98 work just fine both the server and the client since it is loop it must work Any comment whats wrong? Can''''t be root?Reboot! mount -r /home/hell
Can't be root?Reboot!mount -r /home/hell
netstat -an

it sounds like something is already listening on that port.
Advertisement
Yep
Thanks
It is realy what you says
error 98
Because Closing terminal window probably not killing the process?
So on next server start it fail in bind .

Probably Only One can be binded to specified port?

Can''''t be root?Reboot!
mount -r /home/hell
Can't be root?Reboot!mount -r /home/hell
The listening socket will persist or a while after the application exits. You can set a specific sock option to stop it from doing that. I don''t remember what the option was, I only remember that it''s not recommended.

This topic is closed to new replies.

Advertisement