Packet struckt in php?

Discussion in 'Software' started by Raits, Jan 30, 2006.

  1. Raits

    Raits Private E-2

    Hello,
    I am trying to do a bit of testing with php sockets, but the program that is supposed to recive the packets expects them to come in as structures. Is there any way to create them under php? An example of the structure is:
    Code:
    struct InSimInit
    {
    	char	Id	[4];	
    	word	Port;		
    	byte	Flags;		
    	byte	NodeSecs;	
    	char	Admin	[16];
    };
    
    Another question i have is that there is an example of a udp connection on the php.net site:

    The example below shows how to retrieve the day and time from the UDP service "daytime" (port 13) in your own machine. Example 2. Using UDP connection.
    PHP:
    <?php
    $fp 
    fsockopen("udp://127.0.0.1"13$errno$errstr);
    if (!
    $fp) {
       echo 
    "ERROR: $errno - $errstr<br />\n";
    } else {
       
    fwrite($fp"\n");
       echo 
    fread($fp26);
       
    fclose($fp);
    }
    ?> 
    But it doesn't seem to do anything?
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds