Winsock Basic API

zhaozj2021-02-16  63

WSAStartup ()

2. Socket (int Af, int Type, int proctocol)

3. INT Bind (socket S, Strut SockAddr_in * name, int namelen);

Struct sockaddr_in {

Short sin_family;

UNSIGNED SIN_PORT;

Struct in_addr sin_addr;

Char sin_zero [8];

}

Struct in_addr {

Union {

Struct {

Unsigned char s_b1, s_b2, s_b3, s_b4,

} s_un_b;

Struct {

UNSIGNED SHORT S_W1, S_W2;

} S_UN_W;

Unsigned long s_addr;

} S_um;

}

INT Listen (socket S, Struct SockAddr_in * addr, int * addrlen);

INT Connect (socket S, Struct SockAddr_in * name, int namelen);

Int Send (Socket S, Char * BUF, INT LEN, INT FLAGS);

Int Recv (Socket S, CHAR * BUF, INT LEN, INT FLAGS);

Sockets with data packets communications do not have to be established, you can skip the connection directly

Int Recvfrom (Socket S, Char * Buf, Int Len, Int Flags, Struct SockAddr_infrom, in * fromlen);

Int Sendto (Socket S, Char * BUF, INT LEN, INT FLAGS, STRUCT SOCKADDR_INTO, INT * TOLEN);

CloseSocket (Socket S);

I still want to draw a picture, I don't know how to paint.

转载请注明原文地址:https://www.9cbs.com/read-16318.html

New Post(0)