I am not very clear why I need to use a HUB?
What is the advantage of using it, other than switches?
quote:
Original post by Anonymous Poster
Go and get a HUB
quote:
Original post by Anonymous Poster
Go and get a HUB
int get_neighbor_node( int me, int width, int height, int direction ){ int row = me / width; int col = me % width; switch( direction ) { case NORTH: return (row == 0) ? -1 : me-width; case EAST: return (col == width-1) ? -1 : me+1; case WEST: return (col == 0) ? -1 : me-1; case SOUTH: return (row == height-1) ? -1 : me+width; } assert( !"should not get here" ); return -1;}
struct sockaddr_in ClntAddr; int cliLen = 16; p=(PKT *)str; for (int i=0; i<2; i++) { recvfrom(sock, str, sizeof(PKT), 0,(struct sockaddr*) &ClntAddr, &cliLen); if (p->Name == CLI11) // from client 11 data1=p->val; if (p->Name == CLI08) // from client 8 data2=p->val; } p->val=(data1+data2)/2; sendto(sock, str, sizeof(PKT), 0,(struct sockaddr*) &ClntAddr, 16); // ? how to send this back to client11 ? p->val=(data1+data2)/4; // assume; sendto(sock, str, sizeof(PKT), 0,(struct sockaddr*) &ClntAddr, 16); // and send this to client8 ? ...