aiight php has a socket api built in , i am writing a socket server with it , my question is
will the socket api work the same on Linux as Windows as because C++ based sockets have different behaviour's on unix based oses then Windows.
the way u make a socket in PHP is
$sock = socket_create($domain,$type,$protocol);
now the $domain can be AF_INET = ip v4 or AF_INET6 = ip v6 or AF_UNIX = which is the unix style socket domains . idk if an AF_INET will work on linux based host ?
did anybody tried doing this before ? or can som1 find it out for me. ( once running i will make the server code open source , its supposed to handle a thousand clients i think you can use it for your own MMO's).
thanks in advance.
fanofcena
Last edited by fanofcena (2011-07-22 06:40:19)
Offline
It should work the same, but I don't know
Offline
i assume it will work the same as i dont want to buy windows for my server as it will change everything i have been so far :'( .. i <3 Linux (for server only ) ..
The other solution is C++ which allows pseudo similar approach. but C++ has different issues ... COMPILER dependency
Offline
fanofcena wrote:
i assume it will work the same as i dont want to buy windows for my server as it will change everything i have been so far :'( .. i <3 Linux (for server only ) ..
The other solution is C++ which allows pseudo similar approach. but C++ has different issues ... COMPILER dependency
ah scratch ought to support sockets!!! lol jk.
Offline
AF_INET will definitely work on Linux...many if not most of the servers running PHP today are running some form of Linux. AF_UNIX is used to communicate with Unix Domain Sockets, not something you need to worry about if you're building an internet application.
So yes, AF_INET is what you want for this type of communication.

Offline
fullmoon wrote:
AF_INET will definitely work on Linux...many if not most of the servers running PHP today are running some form of Linux. AF_UNIX is used to communicate with Unix Domain Sockets, not something you need to worry about if you're building an internet application.
So yes, AF_INET is what you want for this type of communication.
phew.. being a C++ developer i need to be sure about that ^_^ .. ( a lot of times C++ softwares work amazingly on Win but theres no way to do so on Linux ).i know about UNIX Domain sockets btw but an example confused me on php.net the person was finding out which os the interpreter is running on and then making the use of AF_INET or AF_UNIX depending on the os detected so i thought it might be OS specific but i thought its rather good to find out
. Thank you full moon..I amma give u credit in the source code
Offline