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

Go to the source code of this file.

Functions

 if (recvd !="hi there"||recvd2 !="hi yourself")
 
 SystemCall ("socketpair", ::socketpair(AF_UNIX, SOCK_STREAM, 0, fds.data()))
 
pipe1 write ("hi there")
 
pipe2 write ("hi yourself")
 

Variables

std::array< int, 2 > fds {}
 
LocalStreamSocket pipe1 {FileDescriptor(fds[0])}
 
LocalStreamSocket pipe2 {FileDescriptor(fds[1])}
 
auto recvd = pipe2.read()
 
auto recvd2 = pipe1.read()
 

Function Documentation

◆ if()

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

Definition at line 12 of file socket_example_3.cc.

◆ SystemCall()

SystemCall ( "socketpair"  ,
::socketpair(AF_UNIX, SOCK_STREAM, 0, fds.data())   
)

◆ write() [1/2]

pipe1 write ( "hi there"  )

◆ write() [2/2]

pipe2 write ( "hi yourself"  )

Variable Documentation

◆ fds

std::array<int, 2> fds {}

Definition at line 2 of file socket_example_3.cc.

◆ pipe1

Definition at line 4 of file socket_example_3.cc.

◆ pipe2

Definition at line 4 of file socket_example_3.cc.

◆ recvd

auto recvd = pipe2.read()

Definition at line 7 of file socket_example_3.cc.

◆ recvd2

auto recvd2 = pipe1.read()

Definition at line 10 of file socket_example_3.cc.