Problem with java socket, won't listen for more than one datagram package -


I am creating a server (which is now called a server) which is communicating with another server which is I have received (which is now called Server 2).

  • Sends a datagram package to Server 1 on Server 2.
  • Server 2 is supposed to send back two Datagram packages, but I get only one back.
  • Server 2 is not a problem, and sends two packages.

I use VirusHark to sniff the package which comes on cards and server 1.

Package One): "5955 11 99 4.023 9 74 192.168.1.3 192.168.1.2 UDP Source Port: 50000 Destination Port: 50,004"

Package Two (from wireshark): 5958 11 99 4.045830 192.168.1.3 192.168.1.2 ICMP destination not accessible (port not accessible)

The server runs a thread that is listening to the Datagram package.

Code Server 1:

  while (m_keepRunning) {try {term msg receive messages = null; Received Messages = Received (); (If received (ReceiveMessage.getMsgType ()) (TermMsgType.ACK)) {println ("This is a acknowledgment!") // See this function and below if (receivedMessage = Null!) {; } Else {System.out.println ("This is a response"); }} And {System.out.println ("this is nothing"); }}  

Get the function:

  Received Private TermMsg () IOException, TermMsgException throws {byte [] inBuf = new byte [BUF_SIZE_RX]; Datagram Packet InData = New Datagram Packet (Inoubf, BUF_SISZRAC); If (true == first encounter) {start-up start = Rectangle = getStartMsg (wrong); Datagram packet p = macadatagram (artercrack); Socket.send (p); First encounter = wrong; } Socket.receive (inData); If (inData.getLength ()> gt; {message message; Try {msg} Msg.createFromUdp (inData.getData ()); Return message; } Grip (Termosaurus E1) {return tap; }} And {try {thread.sleep (100); } Grip (Interrupted E) e) {} return tap; }}  

Does anyone have a clue? BTW ... I also use it:

  Datagram socket socket; {Socket = new datagramsocket (50004); }  

Do I have to use the server socket for more than one datagram package?

summary: - Port unreachable - can not get package number two

Hope someone can help me in advance thank you

The first problem, as already mentioned in the comment on the question, is that you think that the following two rows should be sent to two UDP packets. There are

  package one (from wireshark) :. "5955 11 99 4.023 9 74 192.168.1.3 192.168.1.2 UDP source port: 50000 Destination port: 50,004" Package two (from wireshark): 5958 11 99 4.045830 192.168.1.3 192.168.1.2 ICMP destination not accessible (port not accessible) < / Code> 

In fact, this is probably an incomplete mark, showing two packages since this:

  Package One (with Wireshark): "5955 11 994.023974 192.168.1.3 192.168.1.2 UDP source port: 50000 Destination port: 50004 " 

This is a server 2 (192.168.1.3) to server 1 (192.168.1.2) for UDP packets . . It is being sent to port 50.004 on server1

  Package two (from wireshark): 5958 11 99 4.045830 192.168.1.3 192.168.1.2 ICMP destination not accessible (port not accessible)  

This is a control message that is being sent from server 2 to server 1, which states that the last packet can not be given because the destination port was not open. This is a response from server 1 to server 2, which does not work with a previous packet delivery attempt. With this you can be understood that why are not you expecting all the packets?


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

jQuery UI: Datepicker month format -

php - multilevel menu with multilevel array -