0% found this document useful (0 votes)
4 views1 page

Sockets

Sockets are virtual endpoints for data transmission between devices over a network, consisting of an IP address, port number, transport protocol, and host name. There are two types of sockets: server sockets that listen for incoming connections and client sockets that initiate connections. The document outlines the TCP and UDP socket lifecycles, detailing the processes involved in establishing and terminating connections.

Uploaded by

belhamri.ibrahim
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Sockets

Sockets are virtual endpoints for data transmission between devices over a network, consisting of an IP address, port number, transport protocol, and host name. There are two types of sockets: server sockets that listen for incoming connections and client sockets that initiate connections. The document outlines the TCP and UDP socket lifecycles, detailing the processes involved in establishing and terminating connections.

Uploaded by

belhamri.ibrahim
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

sockets.

md 2025-05-19

SOCKETS

sockets is a vertaul endpoint for sending or receiving data between devices over a network (like the
phone line).

what makes up a socket

ip address of the host.


port number.
tranport protocol.
host name (like [Link]).

[Link]:80 using TCP → This refers to the HTTP server on that IP.

types of sockets

server sockets : listens to incoming connecitons.


client sockets : initiate the connection to the server.

how it works (for tcp)

the server creates a socket and start listening.


client creates socket and connect to the ip:port of the server.
tcp performs the 3-way-handshake.
both use their sockets to send and recive data.
when done both close the socket.

tcp socket lifecycle

1. both server and client created socket but without bound or connect.
2. the server binds the socket to a local ip and port.
3. the server starts listening for incomming connections.
4. the client tries to connect with the server socket.
5. before starting exchages both agree on communication with 3-way-handshake <SYN:client,
SYN+ACK:server, ACK:client>.
6. now both sides can send and recieve data.
7. connection termination (one side startt to close connection with 4-step process <FIN:client,
ACK:server, FIN:server, ACK:client>)

udp socket lifecycle

same as tcp but there is no connection established, no 3-way-hanshake, no order.

1. creates socket.
2. bind to ip/port.
3. send/receive.
4. close socket.

1/1

You might also like