I'm trying to create a server that will handle simultaneous connections from clients and for simplicity I've decided to save data to the text files, it not one text file but there are many text files which will be located on the server.
The clients (written in VB5.0) will connect to the server only when a user has clicked join button. I have almost more then 57 buttons which are choices a user will select only one button. I will make an example with the first two buttons. Button1 'Cow' , Button2 'Dog'.
Now the client will send this info to the server suppose the user clicked Button1 which is Dog so the message that will be sent to the server will be "Cow, 1, Area"
'Cow' is to tell the server the name of a text file to write in the '1' and the 'Area' will be retrieved by the client on a configuration file which will be located on each client computer but the area will also be used too. Now that I've said that let me break it down to what I have and what I'm trying to do.
On the server I will have folders that will be located in drive 'C:\' the folder structure will be as follows "Date&Year "-> inside I will have two folders: first; on this folder inside it I will have empty text files which will be updated by the server as clients make their selections and each text file will be named as the Clients buttons like "Cow", "Dog" so that if the client sends a message starting with "Cow" the server will know that it should put '1' inside the Cow.txt file on each line and on the second folder I will have 9 folders inside each folder will be named with the province name and inside these 9 folders on each folder I will have the same and equal text files as in folder 1 which are more then 57 text files.
For the second folder the server will get the message from the client as follows "Folder2, Area, Dog, 1" and the server should be able to open folder2 and select the correct province as the Area and locate text file Dog and inside it insert '1'.
My problem is starting the creation of this server, I've looked to some servers but they are for chatting but this is a different scenario and I don't know how I'm going to split the client message so that I can determine which folder to open, which province to open , and which text file to add 1 to, and also there can be almost 10 or higher clients that may send the same request or message at the same time to the server that means each text file will be updated while another thread is updating it so as I'm working with text file I don't know if this can happen.
I've change from Visual Basic because the multithread is a bit a problem with VB and there is no much resources.
I've forgot to mention the connection to the server from client will always be close will only be open once a user click connect or join button then the user will make the choice and the message will be sent the first message goes to the first folder and the client program will display another choice panel for the user to make another selection then the client will send the second message which is for the second folder. First and second message format:
First message: "Cow, 1"
Second message: "Folder2, Area, Cow, 1"
Folder2 will be the name of folder 2. The above was the assumption that a user chose Cow on client side.