• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Client - Server socket in AS3

Explorer ,
Jan 11, 2012 Jan 11, 2012

Copy link to clipboard

Copied

hi every body

i just wana an exiplinantion about socket in AS3

this a java code for socket communication

Server Side
Client Side

serversocket s  = new ServerSocket("ip",port);

Socket client;

while (true)

{

client = s.accept();

DataInptStream d =client.get ...etc

DataOutptStrm o=client.getoutpt....etc

read

write methods

}

Socket client=new socket(port);

Dataoutptstrm SendtoServer=client.getoutpt...

.

.

.

etc

i asked for an implementation for that , i read about but i couldn't understand how could it be

also if i have a java listeneer on a port,, could as3 socket connect to that port, i ment does dataoutpt streams in java will work with as3 sockets???

TOPICS
ActionScript

Views

3.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 17, 2012 Jan 17, 2012

Copy link to clipboard

Copied

LATEST

hi again

in AS3 we cannot build a server but i build a client

a java server runs above

and the client in AS3 is :

var client:socket=new socket();

client.connect("localhost",port);

client.addeventlistener(progressevent.socket_data,read);

function read(e:progressevent):void{

var t:string=e.readutf();

}

function snd(String tt){

if(Client.isconnected){

client.writeutf(tt)

}else{

client.connect("localhost",port);

snd(tt);

}

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines