View Full Version : Need some help about TCP/IP communication
Desolator
08-19-2007, 02:39 AM
I have two options: ApplicationMessageCenter and LuaSockets. Both aren't so easy to implement:
LuaSockets can be easy to implement, but it is very confusing because of the big number of steps required, and I haven't worked on an application that communicates directly via TCP/IP.
ApplicationMessageCenter needs .NET, but that's not the problem. The problem is that it has a server, and clients. Well, I need a combination of client & server and some clients, so that the clients can communicate between them via the server, but the server must be able to send messages to other clients.
Having 2 applications running on one computer to do something that could be done by one application isn't a good thing at all.
Basically I want to make an Internet Cafe administration suite, with the possibility for the clients to communicate between them (so that the users can chat without shouting around), but the cafe admin must be able to see everything that they do (easily done with RemoteDesktopViewer), what they chat about, and be able to open and close PCs.
Thank you for reading this long post and I hope that you can help me.
sside
08-19-2007, 05:34 AM
Hello
Did you try to build client+server (2 in 1) application and you failed?
The server does not send anything. The server only stores messages. It is the client's job to receive messages. By designing a client to send a message to all registered clients (exluding itself) you may achieve what you want. The limitation is that you can't get a list of registered clients, so you must know from before the clients names.
When a client receives a message it removes also that message from the server, so there is no way (right now in this version) to just read the message of some client (it would make a good option to have). Another good option to have would be to be able to get a list of registered clients.
The dll itself is a two in one solution (client + server).
All clients have equal rights. Probably it would have been better to design some admin api.
The vista users may have noticed that net 2.0 is built in. No need to take some action. But i have noticed that some applications written for .net 2.0 do not work under vista or have upredictable behaviour. This has to to with the vista api that has changed radically (despite ms good intentions to keep backward compatibility). I will do what i can and as soon as i can to adjust that.
With Kind Regards
sside
Desolator
08-19-2007, 05:45 AM
Yes, I failed, and it is crucial for the server to be able to read the messages and be able to send messages knowing either computer name or IP (since I won't know how the Cafe Admin will choose to set up the software.
I'm not worried about Vista yet, since most of the computers will be running on XP and the server might be XP or 2003.
Desolator
08-19-2007, 08:55 AM
OK, I lurked around and came up with something.
I can get a list of all the computers connected to the admin pc (we'll call it server), including computer name (aka host), IP address and MAC address. I'll use the host as an identifier. I want to send a command to the server from a client when the user types a message for client X and presses send:
SendMessage(NET_PC_2, Just testing the stuff)
The server will log the computer name, time & message, then send the message to the destination client. Client 1 will see his message, client 2 will see client's 1 message and the server will see client's 1 message.
But this is just 1 function. The server must be able to send OpenComputer() and CloseComputer() commands to any client and the client will act accordingly.
The thing is, can I do this simply, without loads of error checks, via two simple actions: ReceiveMessage() and SendMessage(strComputerHost). The ReceiveMessage() action will be called every 10 ms.
sside
08-19-2007, 11:20 AM
The server must be able to send OpenComputer() and CloseComputer() commands to any client and the client will act accordingly.
Do you mean you are looking for an option to check if the server is online? Why server should be able to send an OpenComputer() and CloseComputer() , to what point and purpose?
The thing is, can I do this simply, without loads of error checks, via two simple actions: ReceiveMessage() and SendMessage(strComputerHost).
The error check is optional. If you don't need to process the error then don't. Beware when using ReceiveMessage. If server is offline or there is no message ReceiveMessage then will return an empty string and without the conditional if (as seen in the example) you will be processing empty strings.
I have the (c++) project open for hours and yet have not been able to write any line of code so far (bussy). My idea is to add a few things like check for server if online and to get a list of clients.
With Kind Regards
sside
Desolator
08-19-2007, 11:47 AM
OpenComputer() & CloseComputer() will do what their name says: open or close a computer. I already said that this is an admin suite for Internet Cafes.
The server will always be online, don't worry. If it isn't, it's not the fault of the application, it's the fault of the administrator.
sside
08-19-2007, 11:56 AM
OpenComputer() & CloseComputer() will do what their name says: open or close a computer.
I might be out of sync here, but do you mean OpenComputer() & CloseComputer() will turn on and off computer or what?
With Kind Regards
sside
Desolator
08-19-2007, 02:19 PM
No, it will lock it with a black screen. The client application will be set as always on top and resized to full screen, as well as an image object placed over everything.
Dermot
08-19-2007, 03:14 PM
If it were me I would just buy an app for this purpose. Why reinvent the wheel. Plus I don't think AMS is the right tool for this.
This looks pretty good and not too expensive. http://www.cafemanager.com/
When you add up the time it would take to create your own, it will be way more expensive. Just my opinion.
sside
08-19-2007, 04:04 PM
Now you can use client+server in one.
Get a list of subscribed clients.
Read message.
IsServerOnline must be tunned up. Also read message, must be done index based (if you want to browse throught client's messages). I'll look into this the comming days.
Also for the option of shutting down clients, i'll look at it the comming days.
With Kind Regards
sside
sside
08-19-2007, 04:06 PM
If it were me I would just buy an app for this purpose. Why reinvent the wheel. Plus I don't think AMS is the right tool for this.
This looks pretty good and not too expensive. http://www.cafemanager.com/
When you add up the time it would take to create your own, it will be way more expensive. Just my opinion.
Why you write applications at first place, Dermot?
But i do agree with you, ams might not be the right tool for that.
With Kind Regards
sside
Desolator
08-19-2007, 04:09 PM
It isn't for me, I'm making this to sell it. 300 euros for unlimited clients is a bit steep IMO, this application is going to be 10 euros. Most Internet Cafes that I've been at were using pirated versions of CafeManager, for the same reason: too expensive. The manager told me that they were forced to do this because most cafes were closed because students were skipping schools days to play some games, and thus they didn't have enough clients to afford it.
The thing that I need is simple TCP communication, either via IP or computer name (doesn't really matter, it's going to be on LAN). .NET isn't a problem, and as I said, it's going to be Windows XP, either Home or Professional (mostly Pro). I understand that AMS isn't the right thing for this, but if the Simple Chat Application and Simple Web Server by Worm worked, I don't see why this wouldn't.
Dermot
08-20-2007, 12:39 AM
Why you write applications at first place, Dermot?
I thought he was building it for himself or a friend because I thought I had read another post about the same thing. Maybe it was someone else.
300 euros for unlimited clients is a bit steep IMO,
When you consider the cost of a premises and all the hardware, 300 euros is a pretty small price for a very important part of the business IMO. But I don't know much about the business. I visited internet cafes a lot when I lived in Spain and they all had very good systems for managing all the computers including billing by the minute etc.
Desolator
08-20-2007, 01:41 AM
Now you can use client+server in one.
Get a list of subscribed clients.
Read message.
IsServerOnline must be tunned up. Also read message, must be done index based (if you want to browse throught client's messages). I'll look into this the comming days.
Also for the option of shutting down clients, i'll look at it the comming days.
With Kind Regards
sside
The computers won't be shut down. Once the client gets the command via message, it makes itself black, full screen and always on top.
sside
08-21-2007, 11:21 AM
http://indigorose.com/forums/showthread.php?p=106862#post106862
Use SetEntryStatus to set the client status (Grant, Deny).
Use GetEntryInfo to get the client's status. If status is Deny then shut the client down (black screen or whatever).
Use ReadMessage to read client's messages (index based).
You can use client+server in one ui. But apart you have more flexibility. For example you can set client's status to Deny from your computer at home... etc...etc.
With Kind Regards
sside
Desolator
08-31-2007, 07:34 AM
OK, status update. I've just finished the communication using LuaSockets (AppMessCenter is too complicated, and all the new features make things even worse), not tested because I don't have a network (well it's only my PC and the router) but anyway. The chat will be sent to all clients by the server, thus making a public chatroom. The server will be able to see all in the chatroom (as any client will be) and use remote desktop to see any client's screen.
Currently only the server is being worked on, as I want to make the complicated stuff first and set up the base stuff, that way it'll be easy to make the client. The thing I need is a way to turn off and on the monitor. Any ideas?
EDIT: I found how to turn off and on the monitor: http://www.indigorose.com/forums/showthread.php?t=20341
wasim21k
09-03-2007, 06:08 AM
ssid that is really nice thing;)
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.