Socket a re - connect

Hi guys,.

my application to connect to a server by using a TCP/IP connection developing socketDemo ConnectThread.

My question is this: how will I know if the connection is lost and I need to reconnect?

Please ask for more details

Concerning

SAM

If you have a reading in the meantime, you will get an IOException.

Tags: BlackBerry Developers

Similar Questions

  • How to create the socket under proxy connection?

    Hello world

    I am creating the socket under proxy connection connection, it isn't working and I put the MDS proxy setting and I am able to create the http connection, but it gives me the error 'Connection refused' when I try the socket connection, so please any body have any idea please help me do this.

    Thanks to advanced

    Tita

    Hello

    peter_strange thank you very much for your support. Kudo for your.

    I found the solution to my old thread. Please see for the answer http//www.answer

  • java.security.AccessControlException on the socket connection

    Hi all

    I'm java.security.AccessControlException on open socket connection, I added permissions API, looks like I missed something.

    SocketConnection sc = null;

    try {}

    SC = (SocketConnection)

    Connector.Open ("socket://10.91.40.120:1883"); ")

    } catch (IOException ex) {}

    Logger.getLogger (NetworkAPI.class.getName ()) .log (Level.SEVERE, null, ex);

    }

    APIpermissions.jpg

    Hello

    You need javax.microedition.io.SocketProtocolPermission to access socket connection.

    Please add the following permissions to the project:

    -client connection: javax.microedition.io.SocketProtocolPermission "socket / / *: *:

    -Server connection javax.microedition.io.SocketProtocolPermission "socket / /: *:

    Concerning

    Alexey

  • Establishing a socket connection between a .swf file and a current-test program (TCP/IP generator - Windows), in AS3.

    I have a problem with a college project, I'm trying.

    Using Actionscript 3, I did a program simple .swf, a smiley face, lively and interactive, which "reacts" number entered in an input box.

    For purposes of this project, I now do the framework for establishing a connection socket with the smiley .swf and another program.

    That's where I run into problems. I have very little knowledge of the AS3 programming, so I'm not sure how the connection - what is required for it, it is.

    To test the connection, I try to use the "TCP/IP builder" program for windows, which allows me to set up a server socket. I need to program the .swf file into a client - to recognize, connect to it, then be able to receive data (so that data then allows for the smiley "react" him--like how he does now with the input-box, 'automatically' as it gets the data, rather than by manual input).

    My attempts at codification it are as follows, with the help of a tutorial (link HERE):

    INSERT HERE THE SOCKET STUFF

    //****************************************************************

    var socket:XMLSocket;

    Stadium. addEventListener () MouseEvent. ( CLICK, doConnect ();

    It connects to the local port, 9001 and applies event listeners

    ( function doConnect ()evt:MouseEvent():void

    {

    Stadium. removeEventListener () MouseEvent. ( CLICK, doConnect ();

    socket = new XMLSocket()'127.0.0.1', 9001);

    outlet. addEventListener () Event. ( CONNECT, onConnect();

    outlet. addEventListener () IOErrorEvent. ( IO_ERROR, onError ();

    }

    This locates the connection (allows us to see what has happened or failed)

    function onConnect () evt:Event():void

    {

    trace ("Connected"();

    outlet. removeEventListener () Event. ( CONNECT, onConnect();

    outlet. removeEventListener () IOErrorEvent. ( IO_ERROR, onError ();

    outlet. addEventListener () DataEvent. ( DATA, onDataReceived ();

    outlet. addEventListener () Event. ( NARROW, onSocketClose ();

    Stadium. addEventListener () KeyboardEvent. ( KEY_UP, keyUp ();

    }

    ( function onError() evt:IOErrorEvent():void

    {

    trace ()"Login failed"();

    outlet. removeEventListener () Event. ( CONNECT, onConnect();

    outlet. removeEventListener () IOErrorEvent. ( IO_ERROR, onError ();

    Stadium. addEventListener () MouseEvent. ( CLICK, doConnect ();

    }

    Here, the flash titles what keyboard key.

    If you press 'q', the connection ends.

    ( function keyUp() evt:KeyboardEvent():void

    {

    if (evt. ( keyCode == 81( ) / / key for q code is 81

    {

    outlet. Send ("exit");

    }

    on the other

    {

    outlet. Send (evt. keyCode );

    }

    }

    It must manage the data that we get from the server.

    ( function onDataReceived ()evt:DataEvent():void

    {

    try {

    trace ()"Server:", evt. data );

    }

    catch (e:Error) {

    trace ('error');

    }

    }

    ( function onSocketClose ()evt:Event():void

    {

    trace ()"Closed connection"();

    Stadium. removeEventListener () KeyboardEvent. ( KEY_UP, keyUp ();

    outlet. removeEventListener () Event. ( NARROW, onSocketClose ();

    outlet. removeEventListener () DataEvent. ( DATA, onDataReceived ();

    Try to connect to the Jack gives me no result (other than a "Connection failed" message when I click the .swf) or the following error message:

    Error #2044: unhandled securityError:. text = Error #2048: security sandbox violation: file:///C|/Users/Marko/Desktop/Završni/Flash%20documents/Smiley%5FTCP%5FIP%5Fv4.swf cannot load data from 127.0.0.1:9001.
    to the Smiley_TCP_IP_v4_fla::MainTimeline/doConnect()()[. Smiley_TCP_IP_v4_fla ] [MainTimeline: frame1:12]

    127.0.0.1 could be supported through your HTTP software, I'm not familiar with the tool you are using. It could also have been show in your hosts file (in Windows you will find here: C:\Windows\System32\drivers\etc). Check to see if something is the substitution of 127.0.0.1 (local loop).

    Apart from that, I've given you source to a rapid AIR server that has just opened a listener to 127.0.0.1:8910 so you would need no other tools to test the client, even if you have a. I just include the source and a product AIR installer so you can reproduce them to see that I do anything malicious. The Server.air file must be "installed" to test it. When you double-click it, it is a Setup. He moved to C:\Program Files (x 86) \Server (should have called something less common in hindsight). It also has a checkbox to run it after installation. If you don't you will see the server pop up a standard window of 550 x 400 with a text inside the box there letting you know that it is listening. Everything connects, messages (channels) and disconnects the will displayed in the Server text box.

    The customer is the only SWF file, you must run, after 'something' listening on the IP address and port configure you with.

    Here is a picture to show you the server is not running in the same folder the SWF did, tell the server and it only run the client exactly how I should it look like all together:

    I'll show you that after running the Server.air Installer, here is the the path of the executable file is running from and the client SWF isn't here. No problem connecting despite being in different places.

    The server is running and says that it is listening on 8910. Feel free to modify the source and reproduce for a different IP/port.

    -J' open the Client.FLA and just run. It creates a new socket, add headphones, connects to 127.0.0.1:8910.

    -The server responds that he sees and accepts the client connection. The server sends a message "connected." (10 bytes) to the customer immediately.

    -The client receives data (String), he draws. The customer sniffs for this specific message, and then sends the server a string "thanks for the connection!

    -The server receives and is coded only to echo the string in the "Echo - thank you to connect!" back to check that the chain is correct.

    -The customer receives the echo of servers (30 bytes), he draws.

  • Connection of Sockets

    Can someone help me how to connect the Flash for a connection to the server using Sockets using in AS3.

    Use following code Update:

    Try
    {
    var mySocket:Socket = new Socket();
    var isConnected:Boolean = false;
    var portNumber:Number = 8000; Enter the Port number to use instead of 8000;
    var IPAddress:String = "localhost"; Enter the IP address of the server instead of localhost.

    The valid range of port numbers is from 1 to 65535
    If (port_number > = 1 & PortNumber)<=>
    {
    Create a new socket.
    mySocket = new Socket;
    Connect to the host and port.
    mySocket.connect (IPAddress, portNumber);

    Add listeners to Bush to begin to communicate with the server.
    mySocket.addEventListener (IOErrorEvent.IO_ERROR, errorOccured);
    mySocket.addEventListener (SecurityErrorEvent.SECURITY_ERROR, errorOccured);
    mySocket.addEventListener (ProgressEvent.SOCKET_DATA, readFromServer);
    mySocket.addEventListener (Event.CONNECT, connectionEstablished);
    }
    on the other
    {
    Display error message
    trace ("Server is not accessible on port" + portNumber + ".");
    ExternalInterface.call("saveglobalscore",score) ("alert", "Server is not accessible on port" + portNumber + ".");
    }
    }
    catch (e)
    {
    Display error message
    trace ("server is not available.");
    ExternalInterface.call("saveglobalscore",score) ("alert", "the server is not available.");

    }

    function readFromServer(evnt:ProgressEvent):void
    {
    Read the message
    var str:String = mySocket.readUTFBytes (mySocket.bytesAvailable);

    Remove the line breaks.
    While (str.indexOf ("\n") > - 1).
    {
    Str = str.replace("\n","");
    }

    While (str.indexOf ("\r") > - 1).
    {
    Str = str.replace("\r","");
    }

    The server message was received...
    trace (STR);
    }

    function writeToServer(toUserName:String,_messageStr:String):void
    {
    If (isConnected)
    {
    var pushStr = "Message from Flash on server";
    mySocket.writeUTFBytes (pushStr);
    mySocket.flush ();
    }
    }

    This function is called when the connection to the server is successful.
    function connectionEstablished(evnt:Event)
    {
    Mark the socket with the connected server connection.
    isConnected = true;
    }

    function errorOccured(evnt:Event)
    {
    An error has occurred
    trace ("an error has occurred!");
    ExternalInterface.call("saveglobalscore",score) ("alert", "an error has occurred!");

    }

  • Connect the Dell Laptop Inspiron Sony Bravia tv

    connected using Tower for vga and tv cable (which has all available sockets) with corresponding connections. Put tv on PC option and laptop off. Just get no. SYNC on the TV screen and nothing on the cell to indicate the cable

    Also when the laptop has been powered tv shut off - looked at the connection but as one of the things he says is disconnect monitor - a little puzzled.

    Please help - we need another cable?

    Set up multiple monitors

    http://Windows.Microsoft.com/en-us/Windows-Vista/set-up-multiple-monitors

    I hope I could help

  • Wired connection only connect to 100MB instead of 1 GB

    Lenovo T60p Widescreen; Windows XP; direct connection to the gigabit switch

    Driver cable; 20/04/06; 9.2.50.0 (before the upgrade TVT)

    Wireless driver; Atheros; 12/13/06; 6.02.75 (before the upgrade TVT)

    -It is that this laptop connects only to 100 MB instead of 1 GB via wired connection.

    -Initially thought it was somehow to do with IE, because TI o/s behaved slowly until I killed the process IE

    Rebooted - no difference

    A ran full TVT updates, including BIOS and not restarted - no difference

    Question: what gives with LAN speed 100 MB vs. 1 GB single connection - it worked OK before.

    Note: The things I kept my eye on are Symantec Antivirus; Symantec Firewall; Internet Explorer, but LAN speed is confusing.

    My apologies if this has been resolved somewhere else and please ask questions of me to clarify anything.

    Thank you.

    Paul

    This chalk up to my alter ego - Dopus Maximus.

    I checked the wiring and found that the user has connected a 100MB switch on the wall socket - which is connected to a switch of 1 GB.  This explains the drop in speed.

    Paul

  • Connection stuck when connecting over BES/MDS

    I have an application called customer MC (later called 'client') who uses a socket connection to communicate with a server, the controller of Mobile (later called "controller").
    The connection is used to exchange information of signaling for control of calls, instant messaging and presence information and uses the SIP protocol.
    There are two ways how I can connect the Client to the controller:
    -Direct TCP (with a configured APN)
    -WIFI
    BES/MDS

    While the first two modes operate smooth we are facing problems with the connection on the SDM service method.

    The client uses the deviceside = false parameter to initialize the socket via the MDS Server connection.
    We did several tracks on the controller and the client and have the impression that the TCP stream is somehow blocked on the BES between the customer and the controller.

    Following things that we discover that day:
    -The TCP connection negotiation works very quickly. Handshake ACK SYN, SYNACK, is always quick.
    -The data channel itself seems to block / latency of data.
    Initially the application did not send data in decision-making, that data was sent to the origin of the side front controller. I worked around this by sending a single packet of data to the stream with data fictitious "\r\n" on the controller to the client directly after the establishment of the connection.
    In this way a steam machine is usable by the customer immediately, but after two messages flow seems to block again.

    I use Windows Server 2007 SP2 64-bit with a BlackBerry® Enterprise Server Express version and an SDM connection BlackBerry Service: 5.0.1.39

    Description of the scenario:
    [13:40:21.737] Client send data first Packet 'REGISTER'
    -Package is received the controller and responded with "401 Unauthorized" immediately after 15.8 msec (see trace packet)
    [13:40:25.619] Client receives the '401 Unauthorized '.
    -Package comes a little late, but still in time (after 3.8 seconds)
    [13:40:26.054] Client sends the REGISTRY with the authorization response
    -the second package never reaches the controller, the connection has expired

    The Server BES itself seems to be functional, since other applications like e-mail or the SSH of Rove client seem to work well.

    -Is it possible to influence the BES server how packages for a socket MDS connection are transferred? Is there a good way to solve the problems on the BES Server?
    I look in the newspapers, the more information I can find a connection is opened and closed again.

    Any tips?

    I finally found a solution for this.

    We have modified the client application to do a function flush() after writing in the stream object.

    Looks like there is a mayor unlike the behavior of the object of the steam of a plug.

    With direct TCP and WIFI all data are send immediately, whereas with the MDS connection all gots queued for the seconds until a flush() function is made.

    So remember: when using the socket via MDS connection allways drain when using the communication of critical data in time.

  • K64F JavaME 8.1: Connectivity issues

    Hello

    I tried to implement the K64F according to the quick Start guide (Windows 7). During the configuration of the USB-serial interface (see also https://mbed.org/handbook/USBSerial) without peripheral supplement has been detected by windows after you connect the second USB (K64F Mirco USB) cable.

    Even on Ubuntu USB that a device is listed when you connect the two cables. I missed something in the installation procedure?

    What COM Port must be selected in the device connection manager?

    At the moment to connect to OpenSDA Micro USB causes a permanent "State of connection '. Opens a connection via putty series fails.

    I also tested the ethernet connection, where the Commission obtains an IP address from the DHCP server. But establishing a connection by using the connection manager providing the IP also does not work.

    CLI tools saves the following statements.

    java-jar proxy.jar - socket 192.168.1.118

    Trying to open the socket with device connection: 192.168.1.118:2201

    [Connected to the Jack: Socket[addr=/192.168.1.118,port=2201,localport=41050]

    Open channel 8 with hash 0x7d87edff

    Channel 8 CLOSED-> OPEN

    notifyResponse AVAILABLE_RESPONSE on channel 8

    AVAILABLE OPEN-> 8 channel

    Open channel 9 with hash 0 x 0

    Channel 8 AVAILABLE-> REQUEST_SENT

    notifyResponse ACK_RESPONSE on channel 8

    Channel 8 REQUEST_SENT-> ACKNOWLEDGED

    Channel 8 has RECOGNIZED-> DATA_SENT

    notifyResponse AVAILABLE_RESPONSE on channel 8

    Channel 8 DATA_SENT-> AVAILABLE

    Channel 8 AVAILABLE-> REQUEST_SENT

    notifyResponse ACK_RESPONSE on channel 8

    Channel 8 REQUEST_SENT-> ACKNOWLEDGED

    Channel 8 has RECOGNIZED-> DATA_SENT

    notifyResponse AVAILABLE_RESPONSE on channel 8

    Channel 8 DATA_SENT-> AVAILABLE

    I read in this forum that there are some problems with the static IPS (see definition IP static in Java ME 8.1 for Freescale MBED K64F). But in my case, I do not change the default setting (== > DHCP)

    Any help is appreciated.

    Thank you

    Thomas - a Java ME recruit on the bleeding edge.

    BTW - well documented Getting Started guide

    Hello

    You should be able to access the K64 console via USB. You only need the connector microUSB OpenSDA for this, and you must install the driver of series mbed USB under Windows. In my case, K64F console is so accessible that COM3 and the K64 displays network (DHCP address) on the market settings.

    For the connection via the channel of IP tools, please try the Device Manager SDK ME first (not the command line proxy) using the DHCP from the K64F address. This generally works reliably, but to eliminate possible problems with the Windows Firewall, don't forget to disable your Windows Firewall for testing purposes.

    Best,

    -Terrence

  • OSB Socket

    Hello
    I am a beginner of SOA and I c# development experience.
    It was built only oracle given sample (http://docs.oracle.com/cd/E13159_01/osb/docs10gr3/transportsdk/example.html) and works well.

    My question is: can I use c# to develop programming socket and the connection with the BSO.

    HOW?

    it very improtent us, pls answer me as soon as POSSIBLE so you well kown.

    Thank you.

    As any OFMW (including SOA and OSB) is developed on Java, I didn't think you can develop a transport of OSB in c# but if you just want to connect to a service of OSB on socket (do you want to develop client socket), you can use any programming language.

    Kind regards
    Anuj

  • SQL database connection

    I have a MS SQL Server 2005 database that I like to connect through the administrator in ColdFusion, but seem to have a lot of problems. I used MS Access without any problem, but it seems to add that the SQL database is a bit more difficult.

    I get the error message:

    Connection verification failed for data source: dbname
    java.sql.SQLException: [Macromedia] [SQLServer JDBC Driver] error socket creation. Connection refused: connect
    The root cause was that: java.sql.SQLException: error [Macromedia] [SQLServer JDBC Driver] socket creation. Connection refused: connect

    What I've read, this error is quite common for all connection problems, so it didn't help out me. I look for a tutorial, but can't seem to find one, can you help or point to a tutorial?

    Thank you!
    SLL

    I found the solution. No matter who has the same issue of type can follow these simple steps:

    http://www.fusioncube.NET/index.php/ColdFusion-SQL-Server-Express.html

  • Can't connect to local mysql

    What could be the cause of the mysql socket to refuse connections - I get the following error:

    MySQL Error 2002
    Unable to connect to the local MYSQL server through socket ' / var/mysql/mysql.sock' (2)

    I use the login name: con1
    Sever localhost
    Mysql username - and several other attempts
    Mysql password - and several other attempts
    Database (go for it)

    I'm on Mac OS x 10.4.10, using Dreamweaver 8.
    I changed my configuration file to run the PHP and it works very well; I was able to set up the tables MySQL using Terminal Server. So what else should I look for? My local info, remote info, and the test server info all point to my local site directory. Prefix of the URL is http://127.0.0.1/~myname/

    Thanks for any help.

    David, your answer was most useful. Find how to make the symbolic link was my next challenge, but I got it and it works! In the Terminal, I found that there was a /tmp/mysql.sock but nothing to/var/mysql/same not a directory for mysql. So I had to create one and then make the link - s. I also had to use the superuser permissions to do.

    On a Mac 10.4.10, here's what you do - in the Terminal
    CD /var/
    sudo mkdir mysql
    CD (to return to the root)
    sudo ln-s /tmp/mysql.sock /var/mysql/mysql.sock

    At any time, you can run the ls command to see all the files and directories in the current directory, so you can keep track of you. Always press cd (enter) to return to the home (root).

    Now when I return to Deamweaver, I can set up a connection to my databases and see them in the list!

    Thanks again for your help, David. I'll check your PHP books too!
    TEDRA

  • Microsoft SQL data source connection error

    I try to connect to a MS SQL database and continue to receive a connection refused error. the error is:

    Connection verification failed for data source: hbsdb
    java.sql.SQLException: [Macromedia] [SQLServer JDBC Driver] error socket creation. Connection refused: connect
    The root cause was that: java.sql.SQLException: error [Macromedia] [SQLServer JDBC Driver] socket creation. Connection refused: connect

    I'm new to MS SQL and do not know if I put it in place correctly. My settings for the DS are as follows:

    Server: localhost port 1433 (if I change (local) takes the time out)

    I have the DS, Database, login, password everywhere. The password and the name is for cold fusion to be able to execute queries and correct stuff? It is not a defined password to access the database? The database has been imported from a system to the top and is located at ServerName\Databases\DB_Name. I need to plug the DB to MS SQL Server somehow? I can
    display database tables, columns, but not connect. any help would be greatly appreciated.

    I am running Microsoft SQL Server 2005 180 assessment, Windows XP SP2, ColdFusion MX 7.1 Developers Edition.

    Thank you
    Drew

    Solved the problem, my username for any reason any was not the owner of the db, he switched to the top and it works fine... Thanks for the help guys.

  • bug in Sockets

    There is a problem, I would say a bug - if I'm wrong correct me - with sockets in Flash Player 9. I use the version 9.0.124.0 on Windows XP debugging, player normal is affected also. Problem is the player is not wait for the download of a policy file, even if the documentation says:

    "When considering a request that requires a policy file, Flash Player or AIR always awaits the completion of any policy file downloads before rejecting a request".
    http://livedocs.Adobe.com/Flash/9.0/ActionScriptLangRefV3/Flash/system/security.html#loadP olicyFile()

    To demonstrate that it must make an effort in the installation program, I think it's easier by the presence of personal firewall user request permissions for outbound connections [some], which has an effect to "pending". During this time, Flash Player waits 3 seconds for a policy file, BUT PROGRAM FLOW IS NOT STOP. The result: socket attempts to connect and fails to do so.

    In the debug log, it looks like this:

    OK: Escalations loaded SWF: http://localhost/flash/socketdemo.swf
    OK: You are looking for < allow-access-from > in policy files to allow loading resources in xmlsocket://adobe.com:1234 by the applicant of http://localhost/flash/socketdemo.swf of data

    (pause)

    WARNING: Timeout on xmlsocket://adobe.com:843 (for 3 seconds) while you wait for the socket policy file. This should be no problem, but see http://www.adobe.com/go/strict_policy_files for an explanation.
    WARNING: Timeout on xmlsocket://adobe.com:1234 (for 3 seconds) while you wait for the socket policy file. This should be no problem, but see http://www.adobe.com/go/strict_policy_files for an explanation.
    Error: Request for resource at the xmlsocket://adobe.com:1234 by the http://localhost/flash/socketdemo.swf applicant failed because the server is not reachable.

    Of course in this case the target 1234 port is not listening, but this is not the point. The crucial point is that the PROGRAM does not EXPECT ANY, CONNECTION FAILURE CAN BE SEEN in A CLIGNOTER YEAR EYE (using the attached Flex script), not after 3 seconds.

    The real problem is that EVEN WHEN THE FILE of STRATEGY IS AVAILABLE AND SHE APPROVED all THE CONNECTIONS, THE PLAYER is not CONNECT to A PORT TARGET. I think the reason for this is the problem described above.

    The problem is similar to the behavior of alert(), which does not wait for a user to click a button. But the alert can be given to an event handler, is an event "download the full policy file?

    http://flexed.WordPress.com/2006/08/04/alertshow-behavour-in-Flex/


    Here's a sample script in Flex, compile with

    mxmlc - file-specs socketdemo.mxml

    and put it in an html stock page, open it in a browser.

    ---

    BTW, you must listen SecurityErrorEvent and log the event.
    If your code is wrong you test the connected property just after the call to connect.
    You must wait for the connection event or an error event.
    Call to connect does not block!
    Think that asynchronous +++

  • Moving to the United Kingdom

    I'm moving permanently to the United Kingdom... .should I wait to buy one until I'm there? Concerned about electric current and plug adapters etc.?

    Hello

    There are no regional differences in the hardware Apple Watch. The included USB adapter will have pins which are located in the country of purchase.

    When the charge socket, you can connect the magnetic charge cable Apple to your choice:

    -L' adapter USB Apple provided with the watch, or;

    -A true 5W Apple (iPhone) or 12W (iPad) USB power adapter, or;

    -An equivalent of certified Apple of one third of the foregoing.

    If loading via USB, you can connect to a USB 2.0 or 3.0 port (if connected to a computer, the compuet must remain on and wake up and the cable must be connected directly to the computer and not in, for example, an external keyboard).

    More information:

    Check your battery and load your Apple Watch - Apple Support

Maybe you are looking for