/* package */ void receive(TcpSegment segment) { // Send the TCP segment's data to the socket listener. if (_listener != null) { _listener.receive(segment.getData(), this); } return; }
/* package */ void setDestinationPort(TcpSegment segment) { byte[] data; // The server socket is telling us the accepted client's // port number. Reset the destination port to that. data = segment.getData(); _port = ((((int) data[0]) & 0x000000ff) << 8) | (((int) data[1]) & 0x000000ff); // Modify the segment's source port so that the ack will // go to the correct destination. segment.setSourcePort(_port); return; }