Copy link to clipboard
Copied
Hello,
I'm considering writing a flash client using sockets to connect to a chat server that I've already written in C#. Unfortunately I don't have any AS experience so was hoping that someone might be able to point me in the right direction (to tutorials or the like for socket connections etc).
any guidance/help would be most appreciated.
thanks,
Burr
Copy link to clipboard
Copied
http://www.kirupa.com/developer/flash8/php5sockets_flash8.htm
Copy link to clipboard
Copied
thanks for the link. can you tell me, does flash require that certain ports be used for sockets (like silverlight does)?
I've tried connecting to my server on the port I set up for the silverlight client (4505) and it can't connect....
Copy link to clipboard
Copied
yes, if you're using as2 you must use the xmlsocket class and you must connect to a tcp port >= 1024.
Copy link to clipboard
Copied
ok thanks for the info. Since my last post I have have rewritten the server with just the bare essentials to connect a socket client to it. I'm using port 9999 and when I connect with the flash client, I have it printing out on the server that a client has connected...this works, yay! However, the flash client sits there for about 30 seconds then spits out the message (from the tutorial you linked me), 'Server connection failed!'.
I've done nothing more on the flash side than what is in the tutorial. It's obviously connecting to the server as the server is reporting that a new client has connected... any ideas here?
The server is a simple c# socket listener. Code below:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Net;
using System.Net.Sockets;
namespace FlashChatServer
{
class ChatServer
{
TcpListener socketServer;
public ChatServer(Form1 obj)
{
socketServer = new TcpListener(IPAddress.Any, 9999);
while (true)
{
socketServer.Start();
if (socketServer.Pending())
{
TcpClient socketConnection = socketServer.AcceptTcpClient();
DateTime now = DateTime.Now;
if(socketConnection.Connected)
obj.ApplyText("New Client Connected - " + now.ToString("MM/dd/yyyy h:mm:ss tt") + "\r\n");
}
}
}
}
}
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more