PDA

View Full Version : php/perl socket server



eirche
October 28th, 2004, 12:16 AM
i am a newbie in socket programming. i am trying to set up a socket server for chatting. chat client is web-based using flash's xmlsocket.

<?php
//
// socket_server.php
//
$address = "localhost";
$port = 9000;
// create socket, bind socket, etc etc...
?>

when working locally, my flash chat client successfully connected to this socket server via xmlsocket. but when chat client is opened from another computer, how to modify socket_server.php for it to work? i made some naive attempts without success. i do not understand this. what else do i need?

would i be better off with perl?

λ
October 28th, 2004, 03:20 AM
It's very difficult writing socket servers - I'd go with a premade one unless you want to learn threading/forking/select, all of which are very hard ;)

eirche
October 29th, 2004, 12:01 AM
never mind, problem solved. my IP viewed from outside is 111.222.111.222. but my ISP doesn't allowed to connect that way. that's why $address="111.222.111.222" didn't work. i gotta use $address="192.168.2.2" my LAN ip.

thx for njs12345's reply