I am a college student developing a local chat application using VB.Net and SQL 2005. I have multiple clients connected to a server via local ip. My first problem is, how will I know which users are online. Each user has their own username and password in order for them to log-in to the application. I've tried putting code con.execute("update tbl_user set status='ONLINE'") on the log in button and use con.execute("update tbl_user set status='OFFLINE'") on the logout button. However, when the program terminates unexpectedly, it does not update the status in SQL. Is there a better way to do this?

My second problem is the file transfer. I would like the users that are connected locally be able to send files to each other. It's like attaching a file in my chat application and send it to another user. How can I do that using VB.net and SQL?

Recommended Answers

All 2 Replies

Your response will be highly appreciated. Thanks.

You can try to make each client send a message to the server every 5 seconds. If no message was received from a client for about 7 seconds, the client is most probably offline. These numbers can vary, but there must be a permanent communication between clients and server.

Assuming you're using a TCP client/server...you can send the file to the server by writing it's content into a stream (like NetworkStream) - however the content needs to be serialized first (stored into a byte array). Then the server will have to send that file to the receiver client.

-- a better way to do this is to send the files directly (without involving the server).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.