103 struct sockaddr_in sockname;
104 struct hostent *host;
105 int path, val, ret_code, ret;
110 if( (host = gethostbyname(
node)) == (
struct hostent *)0 )
115 if( (path = socket(AF_INET, SOCK_STREAM, 0)) == -1 )
123 if ((ret_code = setsockopt(path, IPPROTO_TCP, TCP_NODELAY,
124 (
char*)&val,
sizeof(val))) == -1 )
127 printf(
"Couln't set TCP_NODELAY\n");
134 if ((ret_code = setsockopt(path, SOL_SOCKET, SO_SNDBUF,
135 (
char*)&val,
sizeof(val))) == -1 )
138 printf(
"Couln't set SO_SNDBUF\n");
145 if ((ret_code = setsockopt(path, SOL_SOCKET, SO_RCVBUF,
146 (
char*)&val,
sizeof(val))) == -1 )
149 printf(
"Couln't set SO_RCVBUF\n");
155 #if defined(__linux__) && !defined (darwin) 157 if ((ret_code = setsockopt(path, IPPROTO_TCP, TCP_SYNCNT,
158 (
char*)&val,
sizeof(val))) == -1 )
161 printf(
"Couln't set TCP_SYNCNT\n");
166 sockname.sin_family = PF_INET;
167 sockname.sin_addr = *((
struct in_addr *) host->h_addr);
168 sockname.sin_port = htons((
ushort) port);
169 while((ret = connect(path, (
struct sockaddr*)&sockname,
sizeof(sockname))) == -1 )