View Single Post
  #3   (View Single Post)  
Old 3rd May 2008
18Googol2's Avatar
18Googol2 18Googol2 is offline
Real Name: whoami
Spam Deminer
 
Join Date: Apr 2008
Location: pwd
Posts: 283
Default

Thanks occicat.

My program is TCP oriented and the following example is for UDP:

Code:
private int getSequenceNumber( DatagramPacket packet )   
 {   
  // Create a byte input stream to read the data  
  ByteArrayInputStream bin = new ByteArrayInputStream (packet.getData());  

  // Create a datainput stream to read sequence number  
  DataInputStream din = new DataInputStream (bin);  

  int sequenceNumber;  

  try  
  {   
   sequenceNumber = din.readInt();  
  }   
  catch (IOException ioe)  
  {   
   sequenceNumber = 0;  
  }   

  return sequenceNumber;  
 }
I have spent almost an hour on google but couldnt work out how to get/set the sequence number with TCP
Reply With Quote