#1
  1. No Profile Picture
    milar
    Guest
    Devshed Newbie (0 - 499 posts)
    I have some data and I have to send it to specified port via TCP/IP. Generally it should work like this:
    I make file with data (this is not problem which I send.I don't know how to do this exactly.

    Do you have any ideas how to do this?
  2. #2
  3. No Profile Picture
    Shawn Vines
    Guest
    Devshed Newbie (0 - 499 posts)
    In order to open a TCP socket use the fsockopen function. Then you fread or fwrite with the correct file handle and then fclose at the end.

    Here is an example below:
    $port_no = 21;
    $timeout = 30;

    $fp = fsockopen("192.168.0.1", $port_no , &$errno, &$errstr, $timeout);

    if(!$fp)
    {
    printf("$errstr ($errno)<br>n";
    }
    else
    {
    fputs($fp,"Hello Worldn");
    fclose($fp);
    }

Similar Threads

  1. configuration file of serial port device
    By chackwal in forum Linux Help
    Replies: 0
    Last Post: February 12th, 2004, 04:34 AM
  2. Pointer problem in opening a file
    By LAKI in forum C Programming
    Replies: 13
    Last Post: February 11th, 2004, 08:27 AM
  3. Pointer problems opening file *formatted*
    By LAKI in forum C Programming
    Replies: 4
    Last Post: February 11th, 2004, 06:06 AM
  4. Sending a file to the printer
    By please_explain in forum PHP Development
    Replies: 3
    Last Post: February 7th, 2004, 11:56 PM
  5. PHP file upload script trouble
    By casbboy in forum PHP Development
    Replies: 9
    Last Post: February 5th, 2004, 07:42 PM

IMN logo majestic logo threadwatch logo seochat tools logo