This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-07-22 06:37:37

fanofcena
Scratcher
Registered: 2008-07-03
Posts: 1000+

I need Help with PHP

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)


http://i53.tinypic.com/2vxr2c0.png Click whats above u might make a cute planet happy ^_^

Offline

 

#2 2011-07-22 08:16:49

gbear605
Scratcher
Registered: 2008-03-06
Posts: 1000+

Re: I need Help with PHP

It should work the same, but I don't know


Yeah, I'm mostly inactive.  I check in once in a while though.  If you want to contact me, I have a contact form at my website, http://escratch.org

Offline

 

#3 2011-07-22 11:41:56

fanofcena
Scratcher
Registered: 2008-07-03
Posts: 1000+

Re: I need Help with PHP

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


http://i53.tinypic.com/2vxr2c0.png Click whats above u might make a cute planet happy ^_^

Offline

 

#4 2011-07-22 11:45:25

fanofcena
Scratcher
Registered: 2008-07-03
Posts: 1000+

Re: I need Help with PHP

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.


http://i53.tinypic.com/2vxr2c0.png Click whats above u might make a cute planet happy ^_^

Offline

 

#5 2011-07-22 13:06:07

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: I need Help with PHP

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.


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#6 2011-07-23 09:09:26

fanofcena
Scratcher
Registered: 2008-07-03
Posts: 1000+

Re: I need Help with PHP

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  big_smile . Thank you full moon..I amma give u credit in the source code  big_smile


http://i53.tinypic.com/2vxr2c0.png Click whats above u might make a cute planet happy ^_^

Offline

 

Board footer