• Post Reply Bookmark Topic Watch Topic
  • New Topic

Unable to receive further messages from tcpip server after handshake  RSS feed

 
Divya Kambhatla
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am trying to come up with a solution to the Airtime Coding Challenge at http://challenge.airtime.com:2324/instructions in Java.
Basic Scenario is as follows:

Step1: Connect to the TCP server at challenge.airtime.com:2323
Step 2: Upon connection, the server will send you a handshake packet: "WHORU:<challenge number>\n" without quotes, encoded in UTF-8.
Step 3: You must then send an identification packet: "IAM:<challenge number>:<user email address>:at\n" without quotes, encoded in UTF-8.
Step 4: If the identification was successful, the server will respond with a success packet containing your identification code. "SUCCESS:<identification code>\n" without quotes, encoded in UTF-8.

My Code is as follows:


I am unable to go past sending the Identification Packet to the server. I only get a Null from the tcp server for my Identification Packet instead of "SUCCESS:<identification code>\n"

The output i get is as follows:

The Output i receive is as below:

Message sent to the server is Hello AirTime Challenge!

Message received from the server is WHORU:4741557577

constructing the Identification packet to be sent to server...

The first part of response is WHORU

The second part of response is 4741557577

Identification packet that will be sent to the server is IAM:4741557577:sampleuser@gmail.com:at

Message received from the server is null

I am unable to understand why I am getting a NULL from the server in response to my identification packet...

Please help!!

Thanks.
 
Ron McLeod
Bartender
Posts: 1603
232
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Divya Kambhatla wrote:Step1: Connect to the TCP server at challenge.airtime.com:2323
Step 2: Upon connection, the server will send you a handshake packet: "WHORU:<challenge number>\n" without quotes, encoded in UTF-8.
Step 3: You must then send an identification packet: "IAM:<challenge number>:<user email address>:at\n" without quotes, encoded in UTF-8.
Step 4: If the identification was successful, the server will respond with a success packet containing your identification code. "SUCCESS:<identification code>\n" without quotes, encoded in UTF-8.


Why are you sending Hello AirTime Challenge! after a connection is made?  I don't see that in the steps that you provided.
 
Ron McLeod
Bartender
Posts: 1603
232
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, tools like Wireshark are useful when troubleshooting network-based applications.  I can see when running your code, that the server reset the connection after receiving your IAM packet.

 
Divya Kambhatla
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ron,

"Hello Airtime Challenge" is sent only initially to get a handshake response from the tcpip server. Once I get an initial handshake response from the server, as WHORU:<somenumber1> I then construct an identification packet as IAM:<somenumber1>:<user email>:at\n and send this to the server expecting a success<somenumber1>...

The second time I send a message to the server, ie. Once a connection is established , I construct the identification packet to send it to the server...

Thank you. Please do let me know if you need more clarification...
 
Divya Kambhatla
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ohhh... could you please suggest/explain why the server is resetting my connection.. And what can I do to stop this reset from happening.
 
Ron McLeod
Bartender
Posts: 1603
232
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Divya Kambhatla wrote:"Hello Airtime Challenge" is sent only initially to get a handshake response from the tcpip server.

That is not part of the protocol description, and I doubt that it is needed by the server to trigger sending the WHORU packet.  My guess is that the server is seeing your Hello packet as a response to the WHORU packet, and dropping the connection because your code is violating the handshake protocol.

Try not sending the Hello packet, and see how the server behaves.
 
Divya Kambhatla
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok Ron,I get what you are saying...I will definitely try that out and get back to you... Thank you so much...
 
Ron McLeod
Bartender
Posts: 1603
232
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a graphical representation of what I was saying.  There is a delay from when one side sends a packet and when the other side receives a it.  The network delay/latency for me is around 45ms - might even be longer for you.

Look at the packet flow both the client's and the server's perspective.

From the client's point-of-view, it is:
   - sending the Hello packet
   - receiving the the WHORU packet
   - sending the the IAM packet

From the server's point-of-view, it is:
   - sending the WHORU packet
   - receiving the the Hello packet
   - resetting the connection because the Hello packet was unexpected

 
Divya Kambhatla
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ron,

  You are correct. The server was not expecting a HelloPacket from the client..for it to send a WHORU packet. Just a connection would be sufficient.

   As you suggested , I ran my program without the first Hello Packet and i got a SUCCESS message from the server..

Output::

Message received from the server is WHORU:9832481028

constructing the Identification packet to be sent to server...

The first part of response is WHORU

The second part of response is 9832481028

Identification packet that will be sent to the server is IAM:9832481028:sampleuser@gmail.com:at

Message received from the server is SUCCESS:743204

However, I am doubtful as to what needs to be done further more with the dump that the server will send me..

The protocol at http://challenge.airtime.com:2324/instructions goes as follows:

"Once the server sends the success packet, it will begin sending the entire satellite dump over the socket.

In order to help understand the transmission, we have stolen an excerpt of a secret document that may help.
    2.1

       Each packet has the following structure:
         0   4   8   12
         +---+---+---+=============================+
         |SEQ|CHK|LEN|…LEN bytes of raw Linear PCM |
         +---+---+---+=============================+

      CHK (Checksum)
         The 32-bit checksum is calculated by XOR'ing each 32-bit chunk of
         the 4 byte big-endian sequence number(SEQ) and data.  If LEN is
         not a multiple of 4, the byte 0xAB shall be used in place of the
         missing bytes only for the purpose of calculating the checksum.

Hint: Next steps will become apparent once you are able to understand the transmission. Hint: Some interesting websites that may be useful for your mission are FFmpeg and Audacity "

I am not sure in what format the dump would be coming in..I tried to get that into String with the below code snippet


and all i can see in my Line variable are special characters . I have attached a snapshot of what dump I received from the server in file ServerDumpAsString.jpeg      

Some people who have taken this puzzle (https://github.com/devmach/airtime-challenge and https://github.com/navio/airtime-challenge-2) are collecting the dump as a .raw file and they suggest using a third party tool to decode the message... Also some of their code in java script shows that they are trying to parse the entire dump ? I am not sure the protocol actually suggests parsing the dump and then decoding it...not sure if i am understanding the further steps correctly Also, i dont understand how we would be able to parse the dump when everything is in special characters...

Requesting your expertise and kind guidance to help me understand further steps...

Thank You.
ServerDumpAsString.jpg
[Thumbnail for ServerDumpAsString.jpg]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!