# XML Sockets trouble

**URL:** <https://forum.kirupa.com/t/xml-sockets-trouble/277805>\
**Category:** flash\
**Created:** [December 17, 2008, 1:44pm UTC](https://forum.kirupa.com/t/xml-sockets-trouble/277805 "2008-12-17T13:44:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew\_B](https://avatars.discourse-cdn.com/v4/letter/a/ce73a5/32.png) [@Andrew\_B](https://forum.kirupa.com/u/Andrew_B)\
**Post date:** [December 17, 2008, 1:44pm UTC](https://forum.kirupa.com/t/xml-sockets-trouble/277805/1 "2008-12-17T13:44:28Z")

</div>

Well recently I have been making a few simple games that aren’t that fun. Everyone who plays them says that they would be more fun if they could play them online against other people.

So I decided to look into sockets in Flash AS2. I already know how to program in other languages, so the server isn’t the problem.

So far, I have made a test application in visual basic .net that just repeats any information sent to it. I can send single messages fine. The trouble is when I try and send a second message to my server, my script doesn’t seem to send anything

I know the problem is to do with my actionscript because I made a test client in visual basic .net and could connect fine and send multiple messages.

My flash animation has nothing on the canvas, only this actionscript:

```auto
function socketSend(xml){
    socket.send(xml);
}

function myOnConnect(success) {
     if (success) {
        trace ("Connection succeeded!");
        socketSend(new XML("Hello World!;"));
        socketSend(new XML("sup?;"));
      } else {
        trace ("Connection failed!")
      }
}
socket = new XMLSocket()
socket.onConnect = myOnConnect
if (!socket.connect("127.0.0.1", 1081)) {
    trace ("Connection failed!")
}

```

After I execute the script, I check my server application and all I says is “Hello World!”. The server application is a console so it’s not being over written and like I said, I have tested the server with other clients and it seems to be working fine.

As you can see, I have experimented with different ways of sending the message. If you can see anything wrong with my code, Please help me out!

In the mean time, I think I might google a few tutorials on something like how to make a chat application in flash so I can see how they are sending messages.

Thank you for any help you may be able to provide,  
Andrew B
