Hi all,
I'm trying to connect a Linux box (running RH7.2) to a UNIX system via a C program I've written. The issue I'm having is that once the code gets to a
setsockopt( ) system call, it returns with the error "Protocol not available". I've tried to do Google searches on the problem but all I get back are IP masquing issues which is not what I'm doing here.
The setsockopt calls are in the 2nd code segment. I've modified the code a little so that it's easier to read here on the board. Pardon any stupid mistakes I've done. Here's what I have so far:
Code:
int HDC_init (unsigned char** HDC_allocptr)
{
int status;
/* Create a TCP client socket and connect to the SBC1 server */
s_addr = inet_addr (SBC1_IP);
printf ("s_addr = %d \n", s_addr);
sin_port = SBC1_PORT;
status = ipcConnect (SBC1_NAME, sin_port, s_addr, RNR_NONBLOCKING, SBC1_SERVNUM);
/*some other irrelevant code down here*/
}
....and here's the ipcConnect function:
Code:
int clientSocket[MAX_PORTS];
int ipcConnect( char *hostname, unsigned int bindAddress, unsigned int netAddress, int block_type, int serverNumber )
{
int i;
int status;
int sendBufSize = MAX_TCP_SIZE;
/* Create an IP-family socket on which to make the connection */
clientSocket[serverNumber] = socket(AF_INET, SOCK_STREAM, 0);
if (clientSocket[serverNumber] < 0) {
perror("(ipcConnect)=> Error returned from socket() ");
return( SOCKET_ERROR );
}
/* Set The System's Buffer Size */
if (setsockopt(clientSocket[serverNumber],SOL_SOCKET,SO_SNDBUF,
(char*) &sendBufSize, sizeof(int)) < 0)
{
perror("(ipcConnect)=> Error returned from setsockopt(SO_SNDBUF)");
return( SOCKET_ERROR );
}
if (setsockopt(clientSocket[serverNumber],SOL_SOCKET,SO_RCVBUF,
(char*) &sendBufSize, sizeof(int)) < 0)
{
perror("(ipcConnect)=> Error returned from setsockopt(SO_RCVBUF)");
return( SOCKET_ERROR );
}
/* some other irrelevant code down here */
}
Any help would be appreciated. Thanks so much in advance.....