0 Replies Latest reply on Jul 10, 2010 8:27 PM by SOMEONEINTHEWORLD

    Not Reading

    SOMEONEINTHEWORLD Level 1

      Hello,

       

       

                  import flash.net.Socket;

       

       

       

                  public var socket:Socket;

       

       

       

                  public function socketData():void

       

                  {

       

                      socket = new Socket();

       

       

       

                      socket.connect("localhost", 1234);           

       

       

       

                      socket.addEventListener(ProgressEvent.SOCKET_DATA, progressEvent);

       

                  }

       

       

       

       

       

       

       

       

       

                  public function progressEvent(event:ProgressEvent):void

       

                  {

       

                      socket.writeUTFBytes("ARRIVAL OF DATA \n");

       

                      socket.flush();

       

       

       

                      var data:String = socket.readUTFBytes(socket.bytesAvailable);

       

                      textarea.text += data;

       

                  }

       

      The client is getting the data but the server is not getting the data

       

       

       

      <?php

       

      $host = "localhost";
      $port = 1234;

       

      set_time_limit(0);

       

      $socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create socket\n");
      $result = socket_bind($socket, $host, $port) or die("Could not bind to socket\n");

       

      $result = socket_listen($socket, 3) or die("Could not set up socket listener\n");

       

      $comSocket = socket_accept($socket) or die("Could not accept incoming connection\n");

       

      echo $socketInput=socket_read($comSocket,1024); // if i comment this line client is getting the data "DATA ARRIEVED".  Not displaying anything if i uncomment it

       

      socket_write($comSocket, "DATA ARRIEVED"); 

       

       

      ?>

       

      Thanks