Jump to content

Search the Community

Showing results for tags 'php socket server side'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. I'm new to the forum and I take this opportunity to say hello at everyone. I'm not an expert on php, but even a neophyte. That being said let's move to the problem, as mentioned in the title concerns the socket. Before putting the parts of the code that interest me start by saying that if to be sent through the socket is a simple sentence and not an array everything is working correctly, then the problem occurs only with an array. 1) client.php: $array = array('Say' => 'hello'); $socket = socket_create(AF_INET, SOCK_STREAM, 0); socket_connect($socket, $host, $port); socket_write($socket, $array, strlen($array)); $result = socket_read ($socket, 1024); 2)server.php: $output = array(); while(1){ $spawn = socket_accept($socket); $input = socket_read($spawn, 1024); array_push($output, $input); socket_write($spawn, $output, strlen ($output)); } Personally I think there is more than one error, first I would say that for example $ input is not an array, but it must contain a value that is an array, then would start already from here, also do not know if it is possible to send an array using sockets. And 'possible or do I have to split the array and I have to send the data twice? Translate from google, sorry for bad english. Bye!!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.