Home Forums Support TCP connection problem.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2385
    Anonymous
    Inactive

    Hi NetworkCommsDotNet,

    – I am developing on IOS with Xamarin. I used NetworkCommsDotNet to connect my server. But it throw:
    Timeout waiting for server connnectionInfo from [TCP] 127.0.0.1:49585 -> 127.0.0.1:8888. Connection created at 13:49:20.140, its now 13:49:30.2

    – And my server log: MINA Input – sessionCreated on Thread: 19

    – I do not understand why my server can create session, but in client it throw time out exception. Here is my code:

    public void Connect (string ip, int port) 
    		{
    			Debug.WriteLine (TAG + " - Connect to ip: " + ip + " and port: " + port);
    			this.IP = ip;
    			this.Port = port;
    			ConnectionInfo serverConnectionInfo = null;
    			try 
    			{ 
    				Debug.WriteLine (TAG + " - Initing Connection Info");
    				serverConnectionInfo = new ConnectionInfo(this.IP, this.Port);
    				Debug.WriteLine (TAG + " - Inited Connection Info");
    			}
    			catch (Exception)
    			{
    				Debug.WriteLine (TAG + " - Failed to parse the server IP and port. Please ensure it is correct and try again.");
    				return;
    			}
    			//We perform the send within a try catch to ensure the application continues to run if there is a problem.
    			try
    			{
    				TCPConnection.GetConnection(serverConnectionInfo, true);
    			}
    			catch (CommsException e) 
    			{
    				Debug.WriteLine (TAG + " - " + e.Message);
    				if (MessageHandler != null) {
    					MessageHandler.OnConnectionFail ();
    				}
    				return;
    
    			}
    			catch (Exception) 
    			{ 
    				Debug.WriteLine(TAG + 
    					" - Error: A general error occured while trying to send message to " + serverConnectionInfo + ". Please check settings and try again."); 
    			}
    			Debug.WriteLine (TAG + " - Connected to ip: " + ip + " and port: " + port);
    			if (Session != null && MessageHandler != null) {
    				MessageHandler.OnConnected ();
    			}
    		}

    Please, give me some idea about that. Thanks.
    Truong PS.

    #2387
    Anonymous
    Inactive

    Heya truongps,

    Many kind thanks for your interest in our network library and welcome to our forums. What version of the library are you using?

    “127.0.0.1” is a loopback address and can only be used if your client and server are on the same machine. Please try connecting to your server using a different IP address.

    Regards,
    Marc

    #2390
    Anonymous
    Inactive

    Hi MarcF,

    – I get NetworkCommsDotNet from Xamarin Component Store.
    – I run my server on local, my client and server are on the same machine. So the server ip is: 127.0.0.1. And it throw this. My server based on Apache Mina.

    Thanks for your attention,
    TruongPS

    #2394
    Anonymous
    Inactive

    Heya TruongPS,

    The version of NetworkComms.Net on the xamarin component store is 2.3.0, which is over a year old. Could you please test using version 3.0.0 to see if you still have this problem?

    Regards,
    Marc

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.