pe_mitev
October 1st, 2008, 02:33 AM
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.
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.