WSAStartup(0x0101, &wsadata); s = socket(AF_INET, SOCK_STREAM, 0); memset((char*)&clnt_sin, ' ', sizeof(clnt_sin)); clnt_sin.sin_family = AF_INET; clnt_sin.sin_addr.s_addr = INADDR_ANY; clnt_sin.sin_port = 1235; erb = bind(s, (struct sockaddr*)&clnt_sin, sizeof(clnt_sin)); memset((char*)&srv_sin, ' ', sizeof(srv_sin)); hp = gethostbyname("name");// имя хоста. srv_sin.sin_family = AF_INET; srv_sin.sin_port = 1234; memcpy((char*)&srv_sin.sin_addr, hp->h_addr, hp->h_length); erc = connect(s, (struct sockaddr*)&srv_sin, sizeof(srv_sin)); er = WSAGetLastError(); |