Showing posts with label Network. Show all posts
Showing posts with label Network. Show all posts

How to connect client and server by socket



The steps to establish a socket on the client side:

1. Create a socket with the socket() system call

int socket(int domain, int type, int protocol);

[C++]Function Prototypes in Socket programming

accept()

// sys/types.h
// sys/socket.h

int accept(int s, struct sockaddr *addr, socklen_t *addrlen);

[C++]Structs in Socket Programming

Below are IP structs used in socket programming.