![]() |
| | #1 | |
| Registered User Join Date: Nov 2006
Posts: 510
| bind() fails with WSAEACCES after installing some (probably wrong) device driver for my umts hardware my software written in C on WinXP always fails at the point there it tries to bind to a multicast socket with error code WSAEACCES. (I'm not 100% sure that the driver is the reason, but it's installation was the last thing I did before running into that problem) What I tried to solve it: -reboot -reset tcp ip stack -uninstall the driver -try other multicast adress nothing seems to to help so far. msdn just says: Quote:
Does anybody has an idea what else I could try? Thank you in advance!
__________________ http://sourceforge.net/projects/path-finder-as | |
| pheres is offline | |
| | #2 |
| and the hat of Jobseeking Join Date: Aug 2001 Location: The edge of the known universe
Posts: 21,700
| http://www.sockets.com/ch16.htm#Multicast http://beej.us/guide/bgnet/output/ht...alls.html#bind My impression is that multicast is a UDP protocol only. If a single receiver fails to receive a packet, there is no way to ask the sender for another copy, without really mucking up what everyone else is doing. To that end, you don't bind() to a port, but you use sendto() and recvfrom() instead, which supply that information as extra parameters. |
| Salem is offline | |
| | #3 |
| Registered User Join Date: Nov 2006
Posts: 510
| Sorry Salem, I didn't looked carefully enough. The code which causes the problem wasn't written by me. It has nothing to do with multi cast (which is used in another part of the program). The software is widely used and I'm the only one who suffers from that problem, it doesn't happen on any other computer. I extracted the code and was able to reproduce it in the following example: Code: #include <winsock2.h>
int main()
{
WSADATA wsaData;
WORD wVersionRequested = MAKEWORD( 2, 2 );
int err = WSAStartup( wVersionRequested, &wsaData );
if ( err != 0 )
{
return -1;
}
unsigned short port = 8015;
unsigned int bind_addr = htonl(INADDR_ANY);
SOCKET s = socket(PF_INET, SOCK_DGRAM, 0);
struct sockaddr_in addr;
int yes = 1;
if (s < 0) return -1;
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_port = htons(port);
addr.sin_addr.s_addr = bind_addr;
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char*)&yes, sizeof(yes)) < 0)
{
int e = WSAGetLastError();
closesocket(s);
return -1;
}
if (bind(s, (struct sockaddr*)&addr, sizeof(addr)) < 0)
{
int e = WSAGetLastError(); //e == 10013 which is WSAEACCES
closesocket(s);
return -1;
}
};
Why can't I bind?
__________________ http://sourceforge.net/projects/path-finder-as |
| pheres is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Computer fails to detect existing hardware, even with installed drivers! | Yarin | Tech Board | 21 | 06-24-2009 09:49 AM |
| Bind problem | moment | Networking/Device Communication | 2 | 04-24-2009 11:36 AM |
| bind() chosing a port | spank | Linux Programming | 4 | 04-28-2007 10:22 AM |
| What does bind() do, exactly? | Hunter2 | Networking/Device Communication | 9 | 07-07-2005 12:12 PM |
| Bind(); | SirCrono6 | Networking/Device Communication | 5 | 02-26-2005 08:01 PM |