Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP Client and C# Server - Not communicating due to timeout
    primarykey
    data
    text
    <p>I am rather new to socket programming but here goes nothing. </p> <p>I have been trying to do some simple TCP communications between a C# server and a PHP client. However, I have had no luck in getting a connection between them. I am basically sending a desktop application messages through the web browser via PHP socket communication. However, I keep getting a timeout error.</p> <p>My code is the following: </p> <p><strong>My C# Server code - It simply listens and notifies me if a connection is made</strong></p> <pre><code> static void Main(string[] args) { try { IPAddress localAddress = IPAddress.Parse("xx.xx.xx.xx"); TcpListener listener = new TcpListener(localAddress, 4761); listener.Start(1); while (true) { Console.WriteLine("Server is waiting on socket {0}", listener.LocalEndpoint); TcpClient client = listener.AcceptTcpClient(); NetworkStream IO = client.GetStream(); Console.WriteLine("Recieved a connection from {0}", client.Client.RemoteEndPoint); Console.WriteLine("Time to depart."); client.Close(); } } catch (Exception E) { Console.WriteLine("Caught exception: {0}", E.ToString()); } } </code></pre> <p><strong>PHP Client - This is a function I made that simply connects to the server (failing miserably)</strong> </p> <pre><code> public function Hook_Up($Host_IP) { $this-&gt;String_and_Cup = fsockopen("xx.xx.xx.xx", 4761); if($this-&gt;String_and_Cup) { echo "Congratulations, it's a socket connection..."; } else { echo "I'm sorry, the socket connection didn't make it..."; } } </code></pre> <p>All I want to do so far is connect to this server through the browser. I'd appreciate the input on how to do so.</p> <p>Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload