1019 struct sockaddr_in sockname;
1021 struct hostent *host = 0;
1025 int path, val, ret_code, ret;
1028 unsigned char ipaddr_buff[4];
1029 unsigned char *ipaddr = ipaddr_buff;
1030 int host_number = 0;
1033 if(isdigit(
node[0]))
1035 sscanf(
node,
"%d.%d.%d.%d",&a, &b, &c, &d);
1036 ipaddr[0] = (
unsigned char)a;
1037 ipaddr[1] = (
unsigned char)b;
1038 ipaddr[2] = (
unsigned char)c;
1039 ipaddr[3] = (
unsigned char)d;
1060 else if( (host = gethostbyname(
node)) == (
struct hostent *)0 )
1094 *(strchr(
node,
'.')) =
'\0';
1095 host_addr = hostGetByName(
node);
1096 printf(
"node %s addr: %x\n",
node, host_addr);
1099 if( (path = (
int)socket(AF_INET, SOCK_STREAM, 0)) == -1 )
1107 if ((ret_code = setsockopt(path, IPPROTO_TCP, TCP_NODELAY,
1108 (
char*)&val,
sizeof(val))) == -1 )
1111 printf(
"Couln't set TCP_NODELAY\n");
1118 if ((ret_code = setsockopt(path, SOL_SOCKET, SO_SNDBUF,
1119 (
char*)&val,
sizeof(val))) == -1 )
1122 printf(
"Couln't set SO_SNDBUF\n");
1129 if ((ret_code = setsockopt(path, SOL_SOCKET, SO_RCVBUF,
1130 (
char*)&val,
sizeof(val))) == -1 )
1133 printf(
"Couln't set SO_RCVBUF\n");
1139 #if defined(__linux__) && !defined (darwin) 1141 if ((ret_code = setsockopt(path, IPPROTO_TCP, TCP_SYNCNT,
1142 (
char*)&val,
sizeof(val))) == -1 )
1145 printf(
"Couln't set TCP_SYNCNT\n");
1150 sockname.sin_family = PF_INET;
1153 sockname.sin_addr = *((
struct in_addr *) ipaddr);
1155 sockname.sin_addr = *((
struct in_addr *) host->h_addr);
1158 sockname.sin_addr = *((
struct in_addr *) ipaddr);
1160 sockname.sin_addr = *((
struct in_addr *) &host_addr);
1162 sockname.sin_port = htons((
ushort) port);
1163 while((ret = connect(path, (
struct sockaddr*)&sockname,
sizeof(sockname))) == -1 )
1172 strcpy(
Net_conns[conn_id].task, task );
DllExp DIM_NOSHARE NET_CONNECTION * Net_conns
int dim_tcpip_init(int thr_flag)
Warning because the service this data corrsponds to might have been last updated longer ago than Local time
static int Write_buffer_size
static int Read_buffer_size
int check_node_addr(char *node, unsigned char *ipaddr)