Home Forums Support Confused

Viewing 10 posts - 1 through 10 (of 12 total)
  • Author
    Posts
  • #1070
    Anonymous
    Inactive

    I am really struggling with this library, the ClientServerExample project does not work “The requested address is not valid in its context”.

    I must admit I find the layout of the project a little unusual for a TCP library. I would be expecting to see something like:
    Server server = new TcpServer(connection);
    server.dataIn += …etc

    Looks like its got some cool features, like PB, but for now I just need something simple that works in winforms, to get started with.

    #1071
    Anonymous
    Inactive

    Heya,

    “The requested address is not valid in its context” – This means you are probably providing an invalid IP address for the remote end. Try running two instances of the example on the local machine and use the loop back address 127.0.0.1

    I must admit I find the layout of the project a little unusual for a TCP library. I would be expecting to see something like:
    Server server = new TcpServer(connection);
    server.dataIn += …etc

    This approach would significantly complicate the more advanced features. The approach used by NetworkComms attempts to simplify the connection relationship and the best way to think of everything is a peer to peer connection, rather than a strict client/server relationship.

    I can confirm the clientServerExample project (completed downloadable example) does work at my end. Please confirm your usage here to locate the issue.

    Regards,
    Marc

    #1072
    Anonymous
    Inactive

    I’m just running the example builds and they both crash. It doesn’t matter that I set the address to 127.0.0.1.

    #1073
    Anonymous
    Inactive

    I’ll help as much as I can to get you up and running. Could you please give me some more information about your environment. OS, .net verison, are you building from visual studio and then running the .exe, etc. Run me through the process from download to running that causes the crash.

    Regards,
    Marc

    #1074
    Anonymous
    Inactive

    Windows 8.0.
    Building in VS2010 express.

    I download the zip file called ClientServerExample.zip, unzip and then try to run the prebuilt exes. I also compile the source code to run. I touch nothing with the source code.

    Error in client:
    Error during TCP connection establish with destination ([TCP] Local -> 127.0.0.1:10000). Destination may not be listening or connect timed out. System.Net.Sockets.SocketException (0x80004005): No connection could be made because the target machine actively refused it 127.0.0.1:10000
    at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
    at System.Net.Sockets.TcpClient.EndConnect(IAsyncResult asyncResult)
    at NetworkCommsDotNet.TCPConnection.ConnectTCPClient()

    Error occurs at:
    NetworkComms.SendObject(“Message”, serverIP, serverPort, messageToSend);

    Error in Server:
    The requested address is not valid in its context
    Error occurs at:
    TCPConnection.StartListening(true);

    #1075
    Anonymous
    Inactive

    Please prevent visual studio from breaking on exception notifications, see Debug > Exceptions, and run again.

    Marc

    #1076
    Anonymous
    Inactive

    I went to CLR exceptions, unchecked User Unhandled.
    The result is the same.

    #1077
    Anonymous
    Inactive

    Untick the ‘thrown’ coloumn for CLR Exceptions, the user-unhandled should remain ticked.

    #1078
    Anonymous
    Inactive

    Thats been unchecked but no difference.

    #1079
    Anonymous
    Inactive

    Going back over what you have written the client error makes sense, if the server cannot start correctly the client has nothing to connect too.

    As to why the server is having problems I’m not currently sure why. You are the first person in several thousand to have such a problem. What I would like you to try is replace the following line in the client source:

    //Start listening for incoming connections
    TCPConnection.StartListening(true);

    with

    //This will force NetworkComms to only listen on adaptors
    //with an ip's matching 127.*.*.*
    NetworkComms.AllowedIPPrefixes = new string[] { "127" };
    //Start listening for incoming connections
    TCPConnection.StartListening(true);

    Then rebuild, check the “created on” time of the executable to make sure you are executing the new version.

    Marc

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