CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2010
    Posts
    33

    PHP sockets theoretic question

    Hey,
    I have PHP file which listens to connections using sockets.
    the clients are C++ applications which open the PHP file (to make it listen) and then connect.
    my question is, what if 2 different applications open the PHP file? will it open 2 different PHP servers? or will it "re-open" the same server each time?
    it's kinda messy question but i hope you understood..
    Thakns!

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: PHP sockets theoretic question

    Sockets can only connect to one port per instance. Duplicating a socket with an open port will be blocked due to port being in use.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Sep 2010
    Posts
    33

    Re: PHP sockets theoretic question

    Hmm yea, you right, didn't think about it. Thanks!

  4. #4
    Join Date
    Sep 2010
    Posts
    5

    Re: PHP sockets theoretic question

    It may be possible to connect to the php script and negociate a port for further communication. For example, client connects on port 80, php file answers "7038" and with proper webserver config it may be possible to have the client connect back to this port, and continue communication here.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured