Jump to content

Simple chat client and understanding the other side has logged in

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
penkomitev

penkomitev

    Learning Programmer

  • Members
  • PipPipPip
  • 31 posts
Hello everybody! I have not visited this forum for about a month, but today I entered in Google "programming forum" and it was the first result I came across and I saw a lot of improvements had been done and I will try to visit it more often. My question today is both language-specific and not so language-spefic. It is related to Sockets at all. I built a simple chat client(.NET, async sockets in my case) that I use to chat to friends because it is faster to open it and have less people in the address book and actually it was more like an exercise for me about async sockets. First, my friends complained that there is no status "Online" for the people that are online and actually no status at all. I was thinking on this problem and a possible solution but I could not decide what exactly should I do. By the way, have in mind that I am the server and for now everybody can connect to me, but not to each other due to beta testing. So, my idea is when somebody from my friends starts his computer, a socket is being sent to my computer and it changes the status in the address book or some stuff like that and it should wait until I click on the "Start chat" button next to the name of the friend I want to write to. The cons of this idea is the timeout and I am not sure that async connect will continue to try forever if the server is down(my pc is not started). Maybe, somehow I timer should check every 1 minute with regular socket to server if it has become online and then if it is ok, close it and start async. You can ask me - why asynchronous sockets? - the answer is simple - most of my friends have more than one pc and are behind routers and I want to build basic client -> server communication. The problem I face with this is when I want to write to a friend, because as long as I am the server this is a problem. I should call their machine somehow and it should connect to me. If they want to connect to me, this is much easier you know. I would like to receive an assessment about this idea and and a possible suggestions about the realization of this calling(when I want to call a friend) or suggestions for different ways to develop this.

I was also thinking about using a php way with MySQL to make a record in the database that I want to connect to somebody.

P.S Sorry that the post became so long, but I had to explain it in details.

Best regards,
Penko, Bulgaria
You can visit something interesting HERE

#2
MeTh0Dz

MeTh0Dz

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,119 posts
Dude just have the client's broadcast status 'online' packets to everyone else.

Easy.

Also you don't "send" sockets.

#3
penkomitev

penkomitev

    Learning Programmer

  • Members
  • PipPipPip
  • 31 posts
Actually, I will have the status of everyone, if my PC is switched on by the time they start their, but what about the other case - they have started before I have started and at some point I enter Windows, start the application and want to see who is available for chat?

P.S Yes, I do not send sockets, client accepts them asynchonously(this word is pretty hard to me to write :D).
You can visit something interesting HERE

#4
MeTh0Dz

MeTh0Dz

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,119 posts
Once again.

BROADCAST STATUS ONLINE PACKETS.

And again.

BROADCAST STATUS ONLINE PACKETS.

#5
penkomitev

penkomitev

    Learning Programmer

  • Members
  • PipPipPip
  • 31 posts
Thanks.
You can visit something interesting HERE