Archived

This topic is now archived and is closed to further replies.

HellCreator

sock binding on *nix vs w98

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites