3 Replies Latest reply on Apr 22, 2010 4:55 PM by MasteryMan

    Weird socket bug, 'Error #2031: Socket Error'

    jflier Level 1
      I'm putting together an application which opens a connection to a server, sends a chunk of binary data and then closes the connection. When I run the application without handing IOEventError, I get the socket error message below but the data sends. When I handle IOEventError, I get the same message passed to the handler but no data is sent. When I capture TCP data during the connection, you can that without the handler a '[PSH, ACK]' packet of length 29 (my data) is sent out. With the handler, a '[FIN]' packet is sent instead. I've pasted the errors, code and TCP traffic below.

      Has anyone else encountered this socket weirdness? How do I figure out what this error message means?

      Thanks for the help!

      -J. Flier

      Error message to the console with no handler (but data sends): "Error #2044: Unhandled IOErrorEvent:. text=Error #2031: Socket Error.
      at handleSendPacketClick()[src\Test.mxml:156]
      at Test_Button2_click()[\src\Test.mxml:333]"

      Error message to the handler (no data sends): "IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2031: Socket Error. URL: 192.168.220.128" errorID=2031"

      TCP traffic with no handler:
      1 0.000000 192.168.220.1 192.168.220.128 TCP timelot > cbt [SYN] Seq=0 Win=65535 Len=0 MSS=1460
      2 0.000484 192.168.220.128 192.168.220.1 TCP cbt > timelot [SYN, ACK] Seq=0 Ack=1 Win=5840 Len=0 MSS=1460
      3 0.000542 192.168.220.1 192.168.220.128 TCP timelot > cbt [ACK] Seq=1 Ack=1 Win=65535 Len=0
      4 0.005418 192.168.220.1 192.168.220.128 TCP timelot > cbt [PSH, ACK] Seq=1 Ack=1 Win=65535 Len=29
      5 0.005615 192.168.220.128 192.168.220.1 TCP cbt > timelot [ACK] Seq=1 Ack=30 Win=5840 Len=0
      6 2.410136 192.168.220.1 192.168.220.128 TCP timelot > cbt [FIN, ACK] Seq=30 Ack=1 Win=65535 Len=0
      7 2.450241 192.168.220.128 192.168.220.1 TCP cbt > timelot [ACK] Seq=1 Ack=31 Win=5840 Len=0
      8 2.486507 192.168.220.128 192.168.220.1 TCP cbt > timelot [FIN, ACK] Seq=1 Ack=31 Win=5840 Len=0
      9 2.486563 192.168.220.1 192.168.220.128 TCP timelot > cbt [ACK] Seq=31 Ack=2 Win=65535 Len=0

      TCP traffic with handler:
      17 438.448287 192.168.220.1 192.168.220.128 TCP dvt-data > cbt [SYN] Seq=0 Win=65535 Len=0 MSS=1460
      18 438.448629 192.168.220.128 192.168.220.1 TCP cbt > dvt-data [SYN, ACK] Seq=0 Ack=1 Win=5840 Len=0 MSS=1460
      19 438.448683 192.168.220.1 192.168.220.128 TCP dvt-data > cbt [ACK] Seq=1 Ack=1 Win=65535 Len=0
      20 438.449489 192.168.220.1 192.168.220.128 TCP dvt-data > cbt [FIN, ACK] Seq=1 Ack=1 Win=65535 Len=0
      21 438.451503 192.168.220.128 192.168.220.1 TCP cbt > dvt-data [ACK] Seq=1 Ack=2 Win=5840 Len=0
      22 438.452759 192.168.220.128 192.168.220.1 TCP cbt > dvt-data [FIN, ACK] Seq=1 Ack=2 Win=5840 Len=0
      23 438.452793 192.168.220.1 192.168.220.128 TCP dvt-data > cbt [ACK] Seq=2 Ack=2 Win=65535 Len=0

      var socket:Socket=new Socket();

      // First we generate our packet
      msg=generateMessage();

      // Then we open a connection
      //socket.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
      socket.connect(backendIPTextInput.text, int(textInput.text));

      // Finally we send the packet
      socket.writeBytes(msg);
      socket.flush();
      socket.close();