can anyone tell me if this is possible for sockets in PHP? I have been looking for answers but have no luck finding them:

  1. when a TCP/UDP socket is accepted with the "$socktest = socket_accept(..." call, is it possible to retrive the IP address of the machine that is trying to connect from?

  2. how do I use sockets with openSSL? is this even possible? I would like to setup a secure socket between the machine and a client program which is not a browser btw. I think with a browser its pretty easy you just install mod_ssl and openssl on the server, but with a non-browser client program I'm not really sure how to do this.

thanks in advance!

    for creating sockets you need methods like [man]fsockopen[/man].
    To accept socket connections using [man]socket_accept[/man] it makes sense only when you are using PHP CLI.
    [man]socket_getpeername[/man] will give you the remote IP address, while [man]socket_getsockname[/man] will give you the local IP address (useful when a machine has multiple IP addresses).

      Write a Reply...