dcsimg
A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 40

Thread: SUPER ADVANCED XML QUESTION!

  1. #1
    Game Developer
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    292
    Ok, I realize this question is a little more technical than most... but I really hope someone out there can find out what I am doing wrong. I Have spent over a month (no lie) trying to get this to work... I am about to go insain

    Anyways... I have already finished making a flash chatroom. It has a windows java program as the server. I want to host the chatroom on my personal computer.

    Here's where it gets complicated.

    Lets pretend my IP address is 123.123.123.123. I have a router that routes between my two computers in my house. I have the router set to route any requests through port 2000 to "my" computer (where the chatroom will be hosted).

    Now... waiting on port 2000 on my computer is my webserver. I am using IIS.

    Ok... so now I have the java program and the chatroom (the swf file). I put both of the files in the "wwwroot" directory (under IIS). This means that both of them (as far as I can tell) can be served out by the webserver.

    So, anyways. I run the java server and tell it to listen on port 9999.

    Up to now... everything is working perfectly.

    Now if within the chatroom, i use the actionscript to connect my chatroom to the java server.

    server = new XMLSocket();
    server.onConnect = initializeChat; //ignore this
    server.onXML = received; //ignore this
    server.onClose = connectionClosed; //ignore this
    server.connect("localhost",9999);

    If I connect to the chatroom by loading the swf in my brower.... EVERYTHING WORKS perfectly. It connects to the server and chatting can commense.

    BUT, here's the problem. Obviously I do not want to connect to "localhost". If it's set to localhost it will only work for me when I run it... but when other users connect to the chatroom "localhost" will not work.

    So, obviosuly I have to use my computers IP address. I have tried EVERYTHING! No matter what I do it never connects. I do know it has something to do with xml security... they have this whole "sandbox" you must not leave.

    I have tried changing the "server.connect" code to all of these:

    server.connect("http://123.123.123.123",9999);
    server.connect("http://123.123.123.123:2000",9999);
    server.connect("http://123.123.123.123:9999");
    server.connect("http://123.123.123.123:2000");
    server.connect("http://123.123.123.123:9999",2000);
    etc..etc...etc...

    None of them work if I connect from a computer outside my network.

    But why does it not work? I know it says on macromedia.com that xml can only access things within the same domain as from where it's swf was called. But I did that. The swf and the java server both reside in the exact same directory on the webserver. There are both at the exact same IP address (except for different ports).

    Does anyone know why this is not working? I honestly have spent "so much time" researching the web for answers. I am not trying to leech free answers... I have done my homework and still failed.

    I would be ever greatful if anyone can help me. Even if it is just a small suggestion maybe I can solve it from that.

    Thanx so much for your time!

    -Ryan

  2. #2
    Senior Member
    Join Date
    Nov 2000
    Posts
    316
    how about, setting apache up instead of using iis?
    if your broadband service provider doesnt block port 80 then run it off or port 80 (the default http port).
    i know my service provider blocks port 80 because of the code red worm (which really sucks). if you cant use port 80 then go back to the ports you originall set up, but try using apache instead of iis. ive never tried iis but i dont see how it could be better than apache? hey worth a shot eh?

  3. #3
    Game Developer
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    292
    Thanx for your reply.

    I've used appache before too.... they are both pretty much the same. I even had this exact same problem when I used apache a couple weeks ago.

  4. #4
    Senior Member
    Join Date
    Nov 2000
    Posts
    316
    interesting.

    server.connect("http://123.123.123.123",9999);
    or
    server.connect("http://123.123.123.123:2000",9999);

    seems as though they would work (one or the other).
    i will continue to think, and post if i think of anything usefull. sorry i couldnt be of any help.

  5. #5
    Game Developer
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    292
    The part that confuses me is that if I run it from home using "localhost" it works perfectly...

    but it's only when I use the ip addresses that it gets messed up. I am almost positive that it has something to do with the xml security... but I just can't figure out what it is...


  6. #6
    Game Developer
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    292
    I know xml can pull documents from the same location that the swf file was pulled from....

    Could that be my problem? I am not actually requesting a file from the main web directory.... I am requesting a service on a specific port (maybe the fact that the service was started from the web directory doesn't matter).

    I know however that this can be accomplished some how... I have seen other websites using xml and a java server to do just what I am trying to do.... but I just can't figure it out..

  7. #7
    Senior Member
    Join Date
    Nov 2000
    Posts
    316
    ya know what?? i had this problem before!!! not with the same thing but with my http server and my ftp server. i think it has to do with your router set up. check your router config... and make sure your ports are being forwarded correctly. aka make sure port 2000 is being forwarded to your local ip like 192.168.1.x
    also check that your gateway is correct (the gateway was my problem). good luck let me know. (if the local host works that mean the services are working fine... but the router is probably the culprit.)

  8. #8
    Game Developer
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    292
    hmm... well, here is how my router is set up....

    First of all... "my" computer is 192.168.2.3

    Private IP Private Port Type Public Port
    192.168.2.3 2000 TCP 2000
    192.168.2.3 2000 UDP 2000
    192.168.2.3 9999 TCP 9999
    192.168.2.3 9999 UDP 9999

    Obviously I am not sure whether something is tcp or udp... so just to make sure I do both for each.

    So basically... if the port i wish to use comes to my router... it route the request to my computer... I think that should be right.

    You were also saying something about the gateway... I have no idea how that works... was I supposed to set something up? Maybe that's my problem?

  9. #9
    Senior Member
    Join Date
    Nov 2000
    Posts
    316
    hrrmmmmm, well if you are using an internet browser on that computer, chances are the gateway is correct.
    what kind of router are you using? how about pluging your cable modem right into your comptuer and bipassing the router completely... change your ips so that your computers ip will not be 123.123.123.123 (or whatever) and try that out. but i wouldnt suggest keeping it that way. if it works, then you know your router is the problem.. and its probably your port forwarding. i use a linksys router and it works great. (do any of your friends have a linksys router you can borrow and try out?)

  10. #10
    Game Developer
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    292
    I have a SMC router... I was too cheap to get the Linksys... :P

    I'll see what I can do about taking to router out of the equation and see if that works...

    I don't know if I already mentioned this but when users type and load the chatroom... they do get the swf and everything... the problem is when the swf gets to the point where it tries to create the xml connection to the server....

    So maybe that means the router is fine... it does let the user get the file... just not make the connection...

    Btw... I found this link which is a little over my head... if you read the paragraph on "Macromedia Player 6 sandbox" it may be a problem. They talk about "tokens"... I have never heard that term before...

    http://www.macromedia.com/desdev/mx/...s/security.pdf

  11. #11
    Senior Member
    Join Date
    Nov 2000
    Posts
    316
    yea, if the user gets the swf file, your router is fine. damn, i really thought that was it = ) ill read that article now. ive never heard that term either, but its worth a shot.

  12. #12
    Senior Member
    Join Date
    Nov 2000
    Posts
    316
    crap, im at work on a new computer, didnt realized acrobat isnt installed on this machine.. and i cant, its a .net coding machine... ill try and take a look tonight.

  13. #13
    Game Developer
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    292
    heh... feel free to wait till you get home, it would probably be nicer to read in adobe anyways..... but if you want to see it now.. I just cut and paste the part i think may be relavent... here it is... (oh and by the way... thanx a ton for your help!!!)


    Macromedia Flash Player 6 sandbox
    The Macromedia Flash Player 6 implements a browser-like security sandbox scheme in order to ensure the security and privacy of both Macromedia Flash movie, as well as the client machine. What is the Sandbox?

    The sandbox defines a limited space in which a Macromedia Flash movie running within the Macromedia Flash Player is allowed to operate. Its primary purpose is to ensure the integrity and security of the client’s machine, and as well as security of any Macromedia Flash movies running in the player. The concept of the sandbox is simple. A macromedia Flash movie executes inside a sandbox. Any information inside the sandbox can be communicated only to the domain from which the movie came. Access to information within the sandbox from outside of the sandbox is severely limited.

    A Macromedia Flash movie’s sandbox consists of:
    - Everything contained in the SWF file
    - User actions directed at the Flash movie
    - Servers in the domain from which the Macromedia Flash movie originated (see Domain-based authentication below)
    - Local SharedObjects written by Macromedia Flash movies from the same
    domain (see Local file I/O access below)
    - Limited configuration information about the computer on which the Macromedia Flash movie is running

    In order to support local development and testing of Macromedia Flash movies by developers, movies accessed as local files (either on the end user's local disk or on LAN servers) have no sandbox limitations. This is consistent with the added caution users should always take when running any type of file locally.

    Domain Domain-based authentication
    As mentioned above, the sandbox includes all servers in the domain, or more correctly the “nth-level sub-domain”, from which the movie originated. Membership in the domain is checked by comparing server names. Two servers are in the same domain if the following are true:
    1 The server names have the same number of tokens.
    2 There are at least 3 tokens.
    3 All but the first token are the same except for differences in case.
    If a server's name is expressed in only one or two tokens (for example, “foo” for foo.macromedia.com), the server is in a domain by itself. If a server is identified by its IP address, the server is also in a domain by itself.

    Macromedia Flash Player 6 sandbox examples:
    - A.B.macromedia.com and C.b.macromedia.com are in the same domain.
    - A.b.macromedia.com and http://www.macromedia.com are not in the same domain (different number of tokens).
    - A.b.macromedia.com and a.c.macromedia.com are not in the same domain (second token differs).

    The idea is that a large domain should be allowed to split into isolated subdomains by using additional tokens in server names. This algorithm is also applied to URLs that include country abbreviations (for example, http://www.hrp.org.uk/).
    The limitation on one- and two-token server names and servers identified by IP address avoids hard-to-compute cases, such as when a user has multiple search domains in their TCP/IP configuration. Two examples that are a result of this are:
    - foo and bar are not in the same domain, but foo.macromedia.com and bar.macromedia.com are in the same domain.
    - http://www.macromedia.com and macromedia.com are not in the same domain, despite the fact that they address the same server.
    The reason for the domain limitation is to protect servers behind firewalls from being attacked by machines outside the firewall. A movie from outside.hacker.org must not be able to read data from any files stored on inside.macromedia.com when the movie is running on a machine behind the Macromedia firewall.

  14. #14
    Senior Member
    Join Date
    Nov 2000
    Posts
    316
    In order to support local development and testing of Macromedia Flash movies by developers, movies accessed as local files (either on the end user's local disk or on LAN servers) have no sandbox limitations. This is consistent with the added caution users should always take when running any type of file locally.
    a few more ideas:

    1) you say you have more than one machine on your LAN, correct? try to access it from the other machine. use http://192.168.1.3:2000 (or whatever it is) and also try http://123.123.123.123:2000

    2) try another method of connecting to the server. how about php or java or i dont know, some means other than flash. see if you can connect. if you can connect with something else, its probably your flash then.

  15. #15
    Game Developer
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    292
    Ok... I started my java server on port 9999...

    I asked my friend to try and "directly" connect to it... so he used his brower and went to "http://123.123.123.123:9999" and my java server did acknolage his existance... I did the same thing from my other computer on my LAN witht he same effect.

    My friend also tried telneting to the java server and it too say the request... (obviosly the server did do much because it doesn't know what to do with these types of requests...but still it noticed that they tried to access it).

    Therefore I am back to my original assumption. The problem is not my router, not the webserver, not the java server, it has to do with either the actionscript I used to connect with the server (but I highly doubt that's it) or the most probable reason, that xml is very picky on what it can access. It thinks that the java server it "outside it's sandbox".

    I just wish I knew how to make the java server within the sandbox...

  16. #16
    Game Developer
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    292
    Anyone else have any ideas? I'm sure chatrooms done with xml and a server have been done tons of times before...

    If anyone else accomplished this... what did you do?

  17. #17
    Member
    Join Date
    Mar 2002
    Posts
    69
    Maybe you should post a link to this thread in the XML board here at flash kit.

    Those guys are heavy into using XML and I'm sure somebody there would have an idea or two for you.

    -thurston

  18. #18
    Senior Member
    Join Date
    Feb 2001
    Location
    Provo, Utah
    Posts
    1,112

    Uhh...

    This will be my first post outside of the XML forum.... ion the last 650ish posts....

    I was hoping to keep the first 1000 in the XML forum... oh well!

    So.

    Have you tried telling Flash to...

    myXML.connect("ipOfYourRouter", 9999)

    Suppose::

    externalIpOfYourRouter=98.76.54.32
    ipOfYourComputer=123.123.123.123
    routerConfig= 98.76.54.32:9999 -> 123.123.123.123:9999

    Then::

    myXML.connect("98.76.54.32", 9999)

    might not work for security reasons. BUT

    myXML.connect("123.123.123.123", 9999)

    wouldn't resolve to a 'real' computer for someone outside of your network.

    Hosting web 'services' inside a network and getting the world to talk to it can be tricky, if you're doing ANYTHING out of the ordinary.. like Flash. The sandox that is talked about is similar to Java's sandbox - play in your own sandbox, and your messes won't make other kids mommies beat up your mommy... And nobody wants a beaten up mommy - right?

    So.

    Try pointing Flash to the router IP - which might work.

    Then try placing the server on an external IP address - like 98.76.54.32. If you place the server on an external IP address you won't have any problems (obviously).

    Having said all of that - I've set up servers (Java/Perl) which only have an internal IP address (123.123.123.123) - and people all over the country have connected to it and used it's 'flash-chat'.. so I know it can work.

    Let us know how those two tests go.

  19. #19
    His Flashy Highness
    Join Date
    Aug 2001
    Location
    SF Bay area
    Posts
    56
    I think VayKent is on the right track here. I also have an SMC router here, by the way. I just logged into it and in the advance section I went to "virtual server" and then I clicked on the "help" link. Here is what that says:

    ---
    Setup | Advanced Settings | Virtual Server
    If you configure the Barricade as a virtual server, remote users accessing services such as Web or FTP at your local site via public IP addresses can be automatically redirected to local servers configured with private IP address. In other words, depending on the requested service (TCP/UDP port number), the Barricade redirects the external service request to the appropriate server.

    Example:

    ID Private IP Private Port Type Public Port Comment
    1 192.168.2.20 80 TCP 200 Web Server
    2 192.168.2.12 21 TCP 333 FTP Server
    3 192.168.2.28 23 TCP 455 Telnet Server
    ---

    I think this should do it

    By the way: I think on of the earlier posts asked if somebody has done such a chat already... I remember that Colin Moock has a fully functional chat + java server on his site (moock.org) for download. That one is based on Flash 5, but that doesn't hurt in this case.

    Juggle5

  20. #20
    Game Developer
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    292
    Ok.. first of all... thank you so much for taking the time to try and help me.

    Ok, in my previous posts I referred to the IP address of 123.123.123.123 that is actually my router's ip. Then each of my computers connected to the router has it's own internal ip of 192.168.2.x (for example).

    I did try what you suggested. I changed the flash actionscript to connect to my routers ip and port 9999. It didn't connect. I have almost tried every combination and nothing works. The wierdest thing is that when i run the chatroom to connect to "localhost" it works perfectly. But if I change it to an IP address (namely my router's ip) it does not work (yes, even if I connect from outside my network). Do you think this is a router problem? Or a xml sandbox problem?

    Juggle5, My router (as far as I know) is configured properly. Like you said, I use the virtual server and forward any requests on port 9999 to the computer running the java server (accepting requests on port 9999).

    Juggle5, I also noticed on the router configuration there is a "Special Application" tab. Could that be something I should use? It looks like more port forwarding... but i don't know....

    Man... I must be dumb. Why is this so hard? I've been doing flash for over 3 years now, and have programmed in over 10 languages... this should be easy.

    *sigh*


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