Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

For my work I need to make this small (VB.NET) application to chat with customers. We have chosen to make this application-style, not web-style.

The idea is very simple:
1. One of the computers (customer / us) needs to be a server. I have made it so that who starts the chatapplication is the server (done by a windows-service that is started by the application).
2. When a customer starts then app, the windows-service is started and one of us at the office get a message and we can connect to the cusomter-computer.
3. When the customer closes the app the windows-service on his/her computer is stopped.

The points above work fine, for 99% perfect... On local network. But the application needs to run over LAN. The problem here is that the TCPListener needs a port and I, the programmer, does not know what port the customer has available.
The other problem is routers. A software-based firewall will notify the user, so it is visible that an app tries to connect to the internet. A router doesn't show anything.

Long story short:
I know I can't avoid a router (if I can, please let me know :-O ). So the questions here are:
How can I avoid that a customer has to forward ports to make use of the application? Is there somethingelse that I can use instead of TCPListener / -Client?
Or if anyone else has a better solutions: Please do!

Thanks in advance and help is much appreciated!
Posted
Comments
Manfred Rudolf Bihy 4-Jan-11 8:01am    
What do you mean by "99% perfect on local network" and then ramble on about "needs to run over LAN". LAN stands for "Local Area Network". So you very likely meant to say WAN (Wide Area Network".

This should get you started:
Simple Chat Application Using .Net Sockets[^]

Usually only the server needs a "fixed" port.

Here is one alternative:
If you want your clients to activly listen to a port on the client machine, you probably need to store this information in a central database to ease management. The client can read it's configuration information from the server during initialization.

Another, and maybe better alternative is to use the functionality under the System.Net.PeerToPeer namespace.
Here is an example Peer Channel Chat[^]

Regards
Espen Harlinn
 
Share this answer
 
Comments
#realJSOP 4-Jan-11 8:20am    
Comment from OP: Thanks for the tips. Few questions though:

"If you want your clients to activly listen to a port on the client machine, you probably need to store this information in a central database to ease management. The client can read it's configuration information from the server during initialization. "

This I don't get. It still means the customer has to forward a port from the router, but he/she has to this once. Correct? If so, not really what I'm looking for.

Peer Channel Chat:
THAT'S an anwser I can look into! Thanks

Because I'm busy on somethingelse (and also I'm a little bit lazy) I have not found if it is possible to send files (such as images) with this functionality... Can this be possible?
And an other question: Where can I find tutorials about this?
Espen Harlinn 4-Jan-11 9:09am    
I felt that the question was somewhat vague, so I threw in a few options. You can use the techniques from Peer Channel Chat to exchange any kind of data you want.
See if your firewall will allow you to specify an application instead of a port number. Most software firewalls should allow this. I think that even my hardware firewall does. Of course, most places have both a hardware firewall appliance in place, as well as software firewalls running, so it might become a moot point.

EDIT (my response to your comment) ====================

There's no getting around having to modify the firewall. You're going to have to put some sort of verbage into your application or documentation giving them general instructions for punching a hole. Your ONLY other (and best IMHO) recourse is to go with a web-based chat system. No special firewall setup is needed for that. In fact, I would probably make it a Silverlight application.
 
Share this answer
 
v4
Comments
#realJSOP 4-Jan-11 8:16am    
From OP: Thanks, but I think we need to think as a customer (and I know the customers): Help! I know how to start the application, but what the ****** is a port/firewall/router????

So, the application needs to send messages (and pictures) from and to the customers application, without any settings to a router or firewall.

Is that even possible?
The setup you describe sounds a little cumbersome. You said you all ready have a windows service, but it runs on the clients side. Why not have the service run on one of your servers 24/7. It would be exposed on a port that you make known to your customers and when a client connects via the chat application a message is shown on the chat clients of the support personnel.
If no support personnel chat clients are currently connected to the chat server an escalation mail is sent to the support service executive.

The message of support requests will be shown on all the clients of the support personnel and as soon as someone responds it will be taken from that list.

What do you think?

Regards,
Manfred
 
Share this answer
 
Sounds good. And it gave me an idea.

The problem now is that I have no idea how much internetconnection is needed when all customers (10000+) are connecting at the same time. If the performance of the internetconnection goes down alot, we have other problems.

The idea is also that a webcam-connection should be possible in the future (something I need to be looking into later). But this on the side.

So, in short:

1. A chat-server on a server here in the office on port 12345
2. The clients connect to the server at port 12345
3. After point 2 we get an message that there is a client requesting a chatsession
4. We connect to the same server at port 12345

But what if a second customer is requesting a chatsession? If he/she connects to the server on port 12345 he/she will be added to the same chatsession as customer 1. This is an issue now.

Also the issue with the internetconnection with 10000+ customers is a questionmark here.
 
Share this answer
 
Comments
Espen Harlinn 4-Jan-11 9:22am    
10000+ customers at the same time. Maybe you need to implement an IRC or instant messaging server

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