I tried INADDR_ANY inaddition to my IpAddr, and tried port numbers of 5001,
2455, etc. with the same errno.
My interface is up and running. ifshow() is proper. I am able to ping my IPAddr.
What could be wrong? Any help to solve the problem ?
Thanks,
Babu
STATUS tcpServer (void)
{
struct sockaddr_in serverAddr; /* server's socket address */
struct sockaddr_in clientAddr; /* client's socket address */
int sockAddrSize; /* size of socket address structure */
int sFd; /* socket file descriptor */
int newFd; /* socket descriptor from accept */
int ix = 0; /* counter for work task names */
char workName[16]; /* name of work task */
unsigned long hAddr;
unsigned long nAddr;
/* set up the local address */
sockAddrSize = sizeof (struct sockaddr_in);
bzero ((char *) &serverAddr, sockAddrSize);
serverAddr.sin_family = AF_INET;
serverAddr.sin_len = (u_char) sockAddrSize;
serverAddr.sin_port = htons (SERVER_PORT_NUM);
/* for some reason getting cann't assign this addr errorno:49 LATER */
/* serverAddr.sin_addr.s_addr = htonl (INADDR_ANY); */
hAddr = inet_addr(tcpServerIpAddr);
nAddr = htonl(hAddr);
serverAddr.sin_addr.s_addr = nAddr;
/* create a TCP-based socket */
if ((sFd = socket (AF_INET, SOCK_STREAM, 0)) == ERROR)
{
perror ("socket");
return (ERROR);
}
/* bind socket to local address */
if (bind (sFd, (struct sockaddr *) &serverAddr, sockAddrSize) == ERROR)
{
perror ("bind");
close (sFd);
return (ERROR);
}
int
sobind(so, nam)
struct socket *so;
struct mbuf *nam;
{
int s = splnet();
int error;
error =
(*so->so_proto->pr_usrreq)(so, PRU_BIND,
(struct mbuf *)0, nam, (struct mbuf *)0);
splx(s);
return (error);
}
Otherwise do a search for socketOption REUSE_ADDR, and you may find the
answer.
Regards,
Patrick
"Babu Yama" <babu...@lucent.com> wrote in message
news:3BB4F274...@lucent.com...