Question: I have a physical wire layer, seen below, and I am having trouble getting it to print out create new socket: (Socket Number). I want

I have a physical wire layer, seen below, and I am having trouble getting it to print out "create new socket: (Socket Number)". I want it to print out after the proper connections are made with the data_link_layer(s). I have an example of what I;m looking for.

I have a physical wire layer, seen below, and I am having

physical_wire.c

#include #include #include #include #include #include #include #include #include "structs.h" void error(const char *msg) { perror(msg); exit(1); } /* Global variable to keep track of the two connections to the physical wire */ int clientlist[2]; /* Receive frame from one data link layer and send it off to the other data link layer*/ void * onesocket(int threadsockfd) { /* Local variables */ int threadN; frame incoming_frame; while (1) { /* Receive a frame from one of the data link layers */ threadN = read(threadsockfd, &incoming_frame, sizeof(frame)); if (threadN  

=========================================================================

data_link_layer.c

#include #include #include #include #include #include #include #include #include #include "structs.h" void error(const char *msg) { perror(msg); exit(1); } /* Global variables to identify where the network and physical wire sockets are */ int network_layersockfd; int wiresockfd; /* Receives frames from the wiresocket and extracts the packet and sends that to the networksocket */ void * rcvfromwiresend2network_layer ( char *argv[] ) { /* Local variables */ int threadN; frame in_frame; /* * Receives the frame from the physical wire, prints out the frame number and type, * then writes the packet to the network layer. */ while (1) { /* Receive frame from wire */ threadN = read(wiresockfd, &in_frame, sizeof(frame)); if(threadN h_addr_list[0], (char *)&wireserv_addr.sin_addr.s_addr, wireserver->h_length); wireserv_addr.sin_port = htons(wireportno); if (connect(wiresockfd,(struct sockaddr *) &wireserv_addr,sizeof(wireserv_addr))   create new socket: 4 reate new socket: 5  create new socket: 4 reate new socket: 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!