Hello,
This is my program :
int sock=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
sockaddr_in a;
a.sin_family=AF_INET;
a,sin_port=htons(atoi(argv[1]));
a.sin_addr.s_addr=inet_addr("127.0.0.1");
if(bind(sock,(sockaddr*)&a,sizeof(sockaddr_in))<0)
cout<<"bind failed,errno="<<errno<<endl;
It generates "bind failed,errno=68" no matter what port I try to bind
to. Someone in the unix.programmer group suggested using
setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,...) - I tried this and it's all
the same.
I don't understand why would the bind fail on all ports ? Has anyone
seen anything like this ? I would appreciate your help.
Thank you,
Martin
Sent via Deja.com http://www.deja.com/
Before you buy.