How to Connect to TCP Server in AIR?

I have a TCP server that apparently is working and is listening for incoming connections:
package
    import flash.display.Sprite;
    import flash.events.EventDispatcher;
    import flash.events.Event;
    import flash.events.*;
    import flash.events.IOErrorEvent;
    import flash.events.ProgressEvent;
    import flash.events.ServerSocketConnectEvent;
    import flash.net.ServerSocket;
    import flash.net.Socket;
    public class TCP extends Sprite
        private var serverSocket:ServerSocket;
        private var clientSockets:Array = new Array();
        public function TCP()
            try
                // Create the server socket
                serverSocket = new ServerSocket();
                // Add the event listener
                serverSocket.addEventListener( Event.CONNECT, connectHandler );
                serverSocket.addEventListener( Event.CLOSE, onClose );
                // Bind to local port 8087
                serverSocket.bind( 8087, "127.0.0.1" );
                // Listen for connections
                serverSocket.listen();
                trace( "Listening on " + serverSocket.localPort );
            catch(e:SecurityError)
                trace(e);
        public function connectHandler(event:ServerSocketConnectEvent):void
            //Thesocket is provided by the event object
            var socket:Socket = event.socket as Socket;
            clientSockets.push( socket );
            socket.addEventListener( ProgressEvent.SOCKET_DATA, socketDataHandler);
            socket.addEventListener( Event.CLOSE, onClientClose );
            socket.addEventListener( IOErrorEvent.IO_ERROR, onIOError );
            //Send a connect message
            socket.writeUTFBytes("Connected");
            socket.flush();
            trace( "Sending connect message" );
        public function socketDataHandler(event:ProgressEvent):void
            var socket:Socket = event.target as Socket
            //Read the message from the socket
            var message:String = socket.readUTFBytes( socket.bytesAvailable );
            trace( "Received: " + message);
            // Echo the received message back to the sender
            message = "Echo -- " + message;
            socket.writeUTFBytes( message );
            socket.flush();
            trace( "Sending: " + message );
        private function onClientClose( event:Event ):void
            trace( "Connection to client closed." );
            //Should also remove from clientSockets array...
        private function onIOError( errorEvent:IOErrorEvent ):void
            trace( "IOError: " + errorEvent.text );
        private function onClose( event:Event ):void
            trace( "Server socket closed by OS." );
But how do I connect to it? I'm trying to make a multiplayer game, and I want variables and strings to be communicated to each client, but what code do I have to put in to get one of the  clients to connect to the other? Again, it successfully LISTENS for a connection, but I don't know how to get anything to connect to it. Another thing is that I get an error thrown at me when I try to test the standalone SWF file, it only listens for connections when I hit "test movie" in the FLA... Thanks in advance...

Well, i don't know how to detect your ps3 on your imac, but i know a way to connect your PS3 to you imac and Macbook, it's called Remote Play, this was created by sony some years ago, read this article for more: http://www.tech-recipes.com/rx/7225/playstation-3-use-remote-play-on-any-non-son y-vaio-windows-7-pc-ps3-firmware-3-30/

Similar Messages

  • Hi I just got my new Apple TV and I cant figure out how to connect it with My MacBook Air (11-inch, Late 2010- Processor  1.4 GHz Intel Core 2 Duo) OSX Version 10.8

    Hi
    Hi I just got my new Apple TV and I cant figure out how to connect it with My MacBook Air (11-inch, Late 2010- Processor  1.4 GHz Intel Core 2 Duo) OSX Version 10.8

    Are you referring to mirroring or you just unable to set up homesharing.
    AirPlay Mirroring requires a second-generation Apple TV or later, OS X 10.8 or better and is supported on the following Mac models: iMac (Mid 2011 or newer), Mac mini (Mid 2011 or newer), MacBook Air (Mid 2011 or newer), and MacBook Pro (Early 2011 or newer). It also requires the computer to be using wi-fi.

  • How to connect to iPad server for email

    How to connect to iPad server to get email

    What do you mean by "iPad server"? Who is your email provider? To add an email account to your iPhone, see Settings>Mail, Contacts, Calendar>Add New Account. If your email provider is not one of the listed ones, you may need to get specific settings from your provider.
    Best of luck.

  • How to connect MS-sql server with SAP BW

    hi all,
    i want the connection procedure to how to connect MS-sql server with SAP BW.so that i can extract the data from ms sql server and can create cubes using that data.please help me in this issue.

    Hi Vamshi,
    Go through this DOC it explains u how to connect to other data bases like SQL...
    [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/58f4db47-0501-0010-a2bf-ff01b150fdff]
    this is a thread related to connect the SQL server..
    [DB Connect MS SQL Server;
    Regards,
    NR
    Assign points if helpful...

  • How to make a tcp server in loop

    Hello everybody!
    I just want to know how to make a server keeping turning even when the client has deconnected.
    My work is based on examples TCP Communicator - Active.vi and TCP Communicator - Passive.vi.
    The problem with these VIs is that when the client deconnects, the server doesn't work any longer, and I want the server to be able to listen for other clients (one client in the same time).
    How can I modify them to apply my will? If you have some examples it will be perfect!!
    Thank you!
    SebGAM

    You could probably get away with putting a big While loop around the server code, but there is always the greatest TCP server example I have ever seen. It lives over at OpenG, the Open Source LabVIEW community. You can download and use it for free. There's even decent documentation right there online.
    EXAMPLE - TCP Server at OpenG
    Beware, the code is not easily understood by the novice LabVIEW programmer. All you need to know is that you should only modify the VI called "TCP Server Example.vi" and "TCP Server Example Connection Handler VI.vi".
    Enjoy,
    Daniel L. Press
    PrimeTest Corp.
    www.primetest.com

  • How to connect my phone to macbook air for the call feature ?

    Hi, my macbook air, 2014 just upgraded to OS X Yosemite. My iPhone is the 5 version, iOS 8.02. I don't know how to connect my phone to the mac for the call feature. What should I do first?
    Thanks very much!

    Check these settings:
    On the phone:
    On your Mac (FaceTime Preferences):
    Your AppleIDs for both need to be identical, and both using the same WiFi network.

  • How can connect to oracle8 server(install in RedHat6.0)

    I have installed Oracle Standard Edition 8.0.5.1
    in RedHat6.0 . Now I can't connect to it with Windows95
    client.
    get an ORA-12500 error.
    1. successful start Oracle use "dbstart"
    2. successful start the LISTENER use "lsnrctl" -- 'start'
    to /home/oracle/805/network/log/listener.log
    Listening on: (ADDRESS=(PROTOCOL=tcp)(DEV=6)
    (HOST=xxx.xxx.xxx.xxx)(PORT=1521))
    Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=magic.com)(PORT=1521)
    (COMMUNITY=UK_SUP_TCPIP))
    STATUS of the LISTENER
    Alias LISTENER
    Version TNSLSNR for linux ......
    Start Date 23-FEB-98 20:38:50
    Uptime 0 days 0 hr. 0 min. 0 sec
    Trace Level off
    Security OFF
    SNMP ON
    Listener Parameter
    File /home/oracle/805/network/admin/listener.ora
    Listener Log
    File /home/oracle/805/network/log/listener.log
    Services Summary...
    xoracle has 1 service handler(s)
    The command completed successfully
    LSNRCTL> exit
    null

    Hi Sushama,
    Seeburger AS2 Adapter supports the SFTP using PI
    Have you checked this threads
    Help needed for SFTP on Seeburger
    How to connect SFTP from the XI
    Regards
    Ramesh

  • How to connect to external server using router from VLAN's

    Hi, I am newbie. I am trying to build network system in Packet Tracer.
    Now I have such network layout.
    I have different VLAN's Accounting and Sales. I have configured this using subinterface in router to allow computers from different vlan's communicate with each other. Everything works.
    Let's assume that there are next subnets and VLAN's. Acct. VLAN (2) (ip's 172.168.0.1-172.168.0.254/24) and Sales VLAN (4) (ip's 172.168.1.1-172.168.1.254/24).
    But I need to connect all this computers to the external server.  That has ip , for instance 192.168.20.13/24. Like this.
    I don't know hot to correctly configure router to make it possible for computers to connect to this server. I have connected switch to the another router interface. And than connected server to the switch and specified ip 192.168.20.13/24. Than I tried to set ip to the router interface from the same subnet like 192.168.20.22/24. So now router can communicate with server.
    But how to allow computers to communicate with the server. Please help. I am newbie.
    I would be grateful for any help.

    Hi Androgen,
    One question for you..How does the sales VLAN computers communicate with the accounting VLAN machines? It's through the inter-VLAN routing that you have already setup.
    Communicating to the external server is also similar to this.
    The computer's in the VLAN should be configured with the default gateway IP which is the the L3 sub-interface IP for that subnet.
    Also, the external server needs to have a default gateway to communicate with other remote subnet. The default gateway of that server would be 192.168.20.22 which is the L3 interface for your external subnet.
    CF

  • How to connect to remote server with jmx from jvisualvm

    I have a WL 10.3.2 domain running on a single box. The adminserver and managed server are running on the same box, on different ports (7001 and 8001, respectively).
    I have a Spring application deployed to the managed server and I've configured it to register a Spring bean as a JMX mbean.
    When I run this entire configuration on my laptop, I can run jvisualvm and connect to my server and see and manipulate my registered mbean.
    I'm having trouble figuring out how to get a remote connection working, however. I want to run jvisualvm on my laptop and connect to the remote server.
    I first did "Add Remote Host", where I specified the IP address. It appears that this was created successfully, and it apparently was able to determine the DNS name for it.
    I then tried to add a JMX connection. In the "Connection" field, I just entered the IP address followed by a colon and 8001 (managed server port number).
    In the "Use security credentials" section, I entered the weblogic admin principal and credentials.
    When I click OK, it chugs for a while and eventually gives up, saying:
    Cannot connect to [email protected]:8001 using
    service:jmx:rmi:///jndi/rmi://nn.nn.nn.nn:8001/jmxrmi
    What might I be missing?

    I've resolved this. At least I was able to configure an authenticated connection. It doesn't use SSL yet, but I'm ok with that for a while.
    Resolving this only required changing the command line parameters for the managed server, and being aware of the "jmxremote.access" and jmxremote.password" files. The following blog article helped a lot: [http://www.dzone.com/links/r/monitoring_your_java_application_with_jmx_part_2.html] .
    I'm now passing the following command-line parameters:
    -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8888 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true
    The default "role" configured in "jmxremote.access" is "controlRole", and the "jmxremote.password" file specifies the credentials for that principal. I simply used that principal and credential in JVisualVM, and the connection succeeded.
    And I just used the "host:port" form, not the protocol form.
    Edited by: david.karr on Feb 4, 2011 12:47 PM

  • How to connect oracle application server portal to MS access DataBase

    Hello,
    I am facing one problem here.
    Our client is having their database in MS access and they want to implement the oracle application server portal for their organization then how to connect the MS access DB to oracle Application server portal

    There is a worked example of how to connect oracle to an Excel spreadsheet, which is easily modifyable to read from an Access Database.
    http://asktom.oracle.com/pls/ask/f?p=4950:61:::::P61_ID:4406708207206#18830681837358
    I had some concurrency problems - only one person could use the link at any one time, so I used it to load the data into oracle tables.
    Tak

  • How to connect a CVS server with remote Hosts(NWDS7.0)

    Hi Frndz..
    I installed CVSNT server in one machine n itz workiing fine with that NWDS in that machine , now i want make connect that CVS server from remote machines NWDS's to use that CVS server as a central repo'
    Can anyone guide me how can i connect that server from remote machines thru NWDS.
    Thnaks in Advance
    Regards
    Rajesh

    rajesh,
    did u check this link
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d079e754-8c85-2b10-8b9a-b36db5262122
    Thanks
    Bala Duvvuri

  • How to connect to lined server in SSMS in SSIS connection manager

    Hi,
    In SSMS (Server name is sqlssisdw1), I have one (SQL Server)linked server name sql4. in that linked server there is DB called rptdb
    Now using SSIS I want to use tables in that DB rptdb.
    So for this I want to create Connection manager, but for this when I select 'New OLEDB connection' and in that in 'Server Name' when I wrote 'sql4' it is not giving me list of DB. I also tried giving sqlssisdw1 in server name and see if I can see this
    rptdb but I can't.
    Can you please tell me how can I connect to lined server in SSMS in SSIS connection manager? Thank you.
    Vicky

    Hi ,
      if you are already having access and login credentials to the remote server which is configured in sql4 , you pretty much directly connect to that server from the connection manager instead of going through a linked server. If you still want to connect
    through the linked server , you need to establish the connection for SQL Server sqlssisdw1 and then
    use a 4 part name query to access the rptdb tables as like below
    SELECT * FROM SQL4.rptdb.<schemaname>.Tablename
    Best Regards Sorna

  • How to Install VPN and how to connect client Application server

    Hi All,
    Could any one tell me. How to connect Client's Application server and How to Install VPN. Thanks in advance.......
    Thanks  & regards
    Vardhan

    where r u working?
    ask your help desk to give the URL link to down load vpn
    after downloading install it, its just like a wizard
    you need to give your userid and password , and secureid number
    secureid is a small device which displays a number(say a 6 digit number ) this number is keeps on changing for every one minitue.
    you need to enter the number which is displaing while you are trying to connect to vpn.
    in the middle of connecting to vpn if your secureid number changed , you need to login once again by the same procedure

  • How to  Connect to ftp server in active mode using the finder

    How can I can I use the finder command "connect to server" to connect to a ftp server using the active Mode. With Cyberduck I can connect to this server only in active mode. Apparently the connect to server command uses the ftp passive mode.
    Or is it an other way to mount on the desktop a ftp server in active mode?
    Thank you

    Passive mode can be disabled in your network settings, but I have a feeling what you're actually asking for is the ability to upload, and the answer to that is the Finder can't do it. There are some filesystem plugins out there that provide this functionality, but they cost money.

  • How to connect to SQL Server from Forms 10g?

    Hello all,
    How do we connect to SQL Server database from Forms 10g?
    In Oracle Metalink site they have suggested using Transparent Gateway for SQL Server as a solution.
    But is there a way we can connect directly to SQL Server from Forms using an ODBC connection
    without installing anything on the database server?
    Pls help!
    Regards,
    Sam

    Hello all,
    I was able to connect to SQL Server from Oracle using Generic Connectivity (HSODBC).
    Transparent gateway was not required.
    Followed metalink note 109730.1
    So, after I created a dblink to SQL Server, I created a synonym for the dblinked SQL Server table.
    When I used the synonym as the table source in Oracle Forms, I got the following error while querying.
    "ORA-02070 - ROWID is not supported in this context."
    This is because Forms has an invisible ROWID field and when data is fetched from SQL Server table
    no Rowid is fetched since SQL Server table doesn't have one.
    Is there a way to overcome this issue or do we have populate the block manually using a SQL query ?
    Pls suggest.
    Regards,
    Sam

Maybe you are looking for

  • Mobile App Packaged as Desktop (with air runtime)???

    Okay, so I have this application that is basically the ubiqutous page turning component you can find online, but modified for mobile.  It's for kid's storybooks.  It's a mobile flex application in FlashBuilder 4.6.  When I export release build for my

  • Cs5 bridge has option..open in raw converter...greyed out

    i just purchased and installed cs5, love the updates i have seen yet.....but cs5 bridge has stopped opening raw files, it actually never did open the first one..the option to open in camera raw is greyed out...i can use photoshop to open raws, one at

  • ITouch will not reset.  Help!

    My ITouch will not reset.  It has the connect to ITunes icon on the screen, but will not connect or reset.

  • AGP Aperture.. What is it and where should it be set?

    While messing with my new MSI video card today I came upon a good question.. what should my AGP Aperture be set at for best performance?  Is it based on amount of system memory?  Video card memory? To refresh your memory I have: AMD XP 1600 Processor

  • BI Precalculation Service on Windows Server 2003

    Hi I am looking to install the BI precalaculation service (SP12) on our BW 3.50 system, when I tried to install it on our BI Windows Server 2003 I get the message 'Setup requires .NET framework version 1.1', we have .NET 2.0 installed, I tried the pr