Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey there. I have created a tcp chat application,Where it has two ends.One is server and other is client, Where Server app is based on console window and will run on the server,And Client app is desktop application which will run on the client.

My project works fine on my laptop when i used localhost as end point for both server and client.But When i run this on two different laptops where Both laptops are connected on same wifi. Where sever app is running on server laptop and client app is running on the client laptop.
But when Client app crashes each time,it means it did not found any connection with the server laptop.I also add inbound rules for allowing connections on 9000 port in firewall settings.but i didnt found any help.Kindly help me urgently

Here are my Client config settings... where 192.168.0.106 is my server IP address

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
    </startup>
    <system.serviceModel>
        <client>
            <endpoint address="net.tcp://192.168.0.106:9000/ChattingService"
                binding="netTcpBinding" bindingConfiguration="" contract="ChattingInterfaces.IChattingService"
                name="ChattingServiceEndPoint" kind="" endpointConfiguration="" />
        </client>
    </system.serviceModel>
</configuration>




And here are the Server Config settings

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
    </startup>
    
    <system.serviceModel>
        <services>
            <service name="ChattingServer.ChattingService">
                <endpoint address="net.tcp://127.0.0.1:9000/ChattingService"
                    binding="netTcpBinding" bindingConfiguration="" name="ChattingServiceEndPoint"
                    contract="ChattingInterfaces.IChattingService" />
            </service>
        </services>
    </system.serviceModel>
</configuration>


What I have tried:

I have tried many methods.I tried to use diffrent laptops.But still i did not found any solution.
Posted
Updated 15-Dec-17 9:39am
Comments
F-ES Sitecore 15-Dec-17 14:00pm    
Start with the basics...can the client connect to port 9000 on the server? You can use telnet to test that (you might have to install it).
Member 13496560 15-Dec-17 14:03pm    
Thanks for your response, Can u please describe more? I tried to ping server ip:port using cmd but it says timeout error
F-ES Sitecore 15-Dec-17 14:10pm    
1) on the client laptop hold down the Windows key and press R
2) enter "cmd" in the run box (no quotes) and press enter
3) in the black box type in (again no quotes) "telnet 192.168.0.106 9000" and press enter
4) if you get an error saying telnet is not recognized as an internal or external command then install it from windows features (I've googled how to do this for you so you don't have to https://technet.microsoft.com/en-us/library/cc771275(v=ws.10).aspx. Now go back to step 3.

If you get an error saying it can't connect then it's likely to be a network problem. If you get a connection, ie a blinking cursor waiting for input or some html appearing on the screen, then it's more likely to be a config issue in your project.
Member 13496560 15-Dec-17 15:02pm    
Yes i tried the following steps.Firstly it was giving error on telnet command . After installing the telnet client i did the same step 3 then cursor just keeps blinking...
So can u tell me how to do config setting on my project? i can email u my project
F-ES Sitecore 15-Dec-17 15:09pm    
You can just type some garbage in and press enter and if you get a response of any kind, even an error one but if you're not getting a connection error then the service probably is running ok and the client can see the server too. Check that the IP\port you connect to isn't hard-wired in the code anywhere and that you are indeed trying to connect to the right IP. You can use something like wireshark to analyse network traffic to make sure it's doing what you think it is.

1 solution

In the server config settings, you may try
XML
<service name="ChattingServer.ChattingService">
    <endpoint address="net.tcp://192.168.0.106:9000/ChattingService"
        binding="netTcpBinding" bindingConfiguration="" name="ChattingServiceEndPoint"
        contract="ChattingInterfaces.IChattingService" />
</service>
instead, and see where it gets you :)
Even if 127.0.0.1 and 192.168.0.106 represent the same host, they are not the same address; so a service bound to localhost address is not automatically bound to other addresses on the same host.
Kindly.
 
Share this answer
 
Comments
Member 13496560 15-Dec-17 15:55pm    
Okey dear i tried the same but still the client app crashes like there is no server running.I tried on different laptop with different with windows 7 operating system but still no problem solved.
phil.o 15-Dec-17 16:35pm    
I cannot see any obvious solution, you have to investigate to solve the issue. Only you can investigate, plus you will learn a lot more if you do so.
So I would first telnet 192.168.0.106 9000 on the server first, see if connection is possible from here. If it's ok from the server, then same telnet but this time from remote computer... You can also try to launch the server with elevated priviledges, in case of an eventual binding problem caused by insufficient rights... Find the culprit and you will be half way to the solution.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900