dcsimg
A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Trying to get started

  1. #1
    madskool.wordpress.com brutfood's Avatar
    Join Date
    Apr 2002
    Posts
    469

    Trying to get started

    Apolgies for my ignorance. I'm trying to get into XML and sockets. Something's not working, and I expect it's in the details or assumptions in what I'm doing:-

    I followed a link at the top of this forum and found Vaykent's chat room server written in Perl (GenericFlashXMLSocketServer.pl).

    As a starting point I took this, renamed it chatroom.pl, and put it in my WebServer/CGI-Executables folder. I run it by typing "perl chatroom.pl". It tells me it's running. I try to access it using the following ActionScript:

    Code:
    function Chat() {//Constructor
    this.mySocket=new XMLSocket();
    this.mySocket.onconnect=this.connection;
    this.mySocket.onclose=this.connectionclose;
    this.mySocket.onXML=this.message;
    this.mySocket.connect("http://127.0.0.1",2229)
    }
    
    mychat= new Chat();
    But the connection() method is called with a false parameter. So it doesn't work. Any suggestions? What am I doing wrong?
    AIR, ActionScript 3, Flex and Flash expert and freelance developer

  2. #2
    Senior Member
    Join Date
    Feb 2001
    Location
    Provo, Utah
    Posts
    1,112
    Where are you running which file??

    Running the SWF from the authoring environment on a bosx that is not the server where your Perl Script is running... won't work. You've got the SWF on one box... the server on another... and the SWF is trying to connect to the machine where it is running.

    So...

    Make sure you're either running the SWF off of the same machine where the Perl server is running, or that your loading the SWF from the same machine where the Perl server is running.

    Let me know if that doesn't work...

    ... I have a different XMLSocket server that is a standalone EXE for Windows.
    Richard Lyman
    rich at lithinos.com
    www.lithinos.com

  3. #3
    madskool.wordpress.com brutfood's Avatar
    Join Date
    Apr 2002
    Posts
    469
    But they ARE on the same machine?

    Perhaps I should have said "/Library/WebServer/CGI-Executables" folder - I can see why I confused you - sorry.

    And I tried null instead of "http://127.0.0.1" - still didn't work. Apache IS definately running.

    By the way, in my previous code example, 'onConnect','onClose' have upper case 'C's

    .exe is no good to me. Should I ask my question in the mac forum?
    AIR, ActionScript 3, Flex and Flash expert and freelance developer

  4. #4
    Senior Member
    Join Date
    Feb 2001
    Location
    Provo, Utah
    Posts
    1,112
    You've placed the SWF in the directory path for your server, and then loaded the SWF through the browser?

    It ~should~ work.

    I don't know that much about Macs, so maybe someone in the Mac forum would know more...
    Richard Lyman
    rich at lithinos.com
    www.lithinos.com

  5. #5
    Senior Member tupps's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne
    Posts
    2,035
    The problem is a little confusion on the side of how a socket server works versus a web server.

    Vaykents socket server connects via the XML socket connection which is seperate from the XML object. The XML object includes the ability to send and receive information from a web server.

    First thing, a socket request does not include the http connection.

    this.mySocket.connect("http://127.0.0.1",2229)

    should be:

    this.mySocket.connect("127.0.0.1",2229)

    The other thing is that the server does not run as part of the web server. It runs as its own process. I am guessing from the local path you gave that you are running on OSX. Move it out of your webserver directory, and place it into a local directory under your user. Then make sure it is running.

    If you need any more help, just reply.

    Thanks

    Luke
    Flash-XML FAQ
    http://www.tupps.com/flash/faq/

  6. #6
    Senior Member
    Join Date
    Feb 2001
    Location
    Provo, Utah
    Posts
    1,112
    < sigh >

    I'm getting to old for this...

    Thanks Tupps.

    < sigh >
    Richard Lyman
    rich at lithinos.com
    www.lithinos.com

  7. #7
    madskool.wordpress.com brutfood's Avatar
    Join Date
    Apr 2002
    Posts
    469
    Woa! - It worked! Thanks guys! The world is my oyster now!

    By the way tupps, I've never done mySQL access from Perl. I've read about a module called pmsql. I don't think I have it in this version - but is that what people tend to use?
    AIR, ActionScript 3, Flex and Flash expert and freelance developer

  8. #8
    Senior Member tupps's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne
    Posts
    2,035
    Not sure, personally if I am looking for Perl Modules to use I have a look at CPAN.

    http://www.cpan.org/

    Thanks

    Luke
    Flash-XML FAQ
    http://www.tupps.com/flash/faq/

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

HTML5 Development Center