Nov 3, 2010 at 7:04pm Nov 3, 2010 at 7:04pm UTC
You cannot bind the same ip/udp port to two different sockets at the same time.
In order to call this function a second time, you will need to close the first socket
(I don't know if you omitted that part in the //blah blah).
Otherwise, print out the value of errno after the call to bind to see what the actual
error was.
Nov 3, 2010 at 7:18pm Nov 3, 2010 at 7:18pm UTC
re:you will need to close the first socket
I have now done this at the bottom:
shutdown(socketId,0);
is this the proper way to close the socket? Because the bind is still failing.
re:print out the value of errno
How do I get this value?
Nov 3, 2010 at 8:10pm Nov 3, 2010 at 8:10pm UTC
close( socketId );
to close the socket.
to get errno:
#include <errno.h>
std::cout << errno << std::endl;
Nov 4, 2010 at 9:33am Nov 4, 2010 at 9:33am UTC
when I do:
close( socketId );
I get:
error C3861: 'close': identifier not found
My project is an MFC project.
Nov 4, 2010 at 9:43am Nov 4, 2010 at 9:43am UTC
closesocket(socketId) works for me.
Cheers
Nov 4, 2010 at 1:31pm Nov 4, 2010 at 1:31pm UTC
yeah, sorry, I only know the posix calls.