Sponge
CS144's user-space TCP library
Functions | Variables
socket_example_1.cc File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

sock1 bind (Address("127.0.0.1", portnum))
 
sock1 connect (recvd.source_address)
 
 if (recvd.payload !="hi there"||recvd2.payload !="hi yourself")
 
sock1 send ("hi yourself")
 
sock2 sendto (Address("127.0.0.1", portnum), "hi there")
 

Variables

const uint16_t portnum = ((std::random_device()()) % 50000) + 1025
 
auto recvd = sock1.recv()
 
auto recvd2 = sock2.recv()
 
UDPSocket sock1
 
UDPSocket sock2
 

Function Documentation

◆ bind()

sock1 bind ( Address("127.0.0.1", portnum )

◆ connect()

sock1 connect ( recvd.  source_address)

◆ if()

if ( recvd.payload !  = "hi there" || recvd2.payload != "hi yourself")

Definition at line 18 of file socket_example_1.cc.

◆ send()

sock1 send ( "hi yourself"  )

◆ sendto()

sock2 sendto ( Address("127.0.0.1", portnum ,
"hi there"   
)

Variable Documentation

◆ portnum

const uint16_t portnum = ((std::random_device()()) % 50000) + 1025

Definition at line 1 of file socket_example_1.cc.

◆ recvd

auto recvd = sock1.recv()

Definition at line 12 of file socket_example_1.cc.

◆ recvd2

auto recvd2 = sock2.recv()

Definition at line 16 of file socket_example_1.cc.

◆ sock1

UDPSocket sock1

Definition at line 4 of file socket_example_1.cc.

◆ sock2

UDPSocket sock2

Definition at line 8 of file socket_example_1.cc.