Jump to content

  • Log In with Google      Sign In   
  • Create Account


server


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 Jeremiah   Members   -  Reputation: 122

Like
Likes
Like

Posted 08 February 2000 - 11:36 AM

Later this year I am going to be buying and running my own web server, and I want to create some services for my users. One service is going to be free web based chat. and Another thing will be an "online artificial intelligence world". I was just curious to the design of a good server. I am wanting to have multiple clients connected, and I want the server to be able to handle multiple requests. For example, for my chat, I want to have multiple rooms, which shouldnt be too much of a problem. Another example, for my A.I. world, the people will get to upload a "creature" they have designed into an artificial environment, and then watch how it interacts with other creatures and random happenings. So they''ll be able to monitor the world in real time. This is just a request for any advice on designing a good server to handle multiple clients all doing different things. would it be better to fork the process so each client gets its own process to handle their requests? Are there any security concerns I need to worry abot when designing my server [and client] programs?

Sponsor:

#2 kressilac   Members   -  Reputation: 110

Like
Likes
Like

Posted 09 February 2000 - 04:06 AM

As for your process thought, it depends on the number of users. As users increase, processes will increase. As processes increase on WindowsNT and other operating systems, so does the time allocated to overhead. The CPU has more to manage. NT isn''t particularly known for its thread management, which is why you don''t see many multithreaded applications out there. Anyway decide for yourself based upon your server size, and your requirements. Read the help in MSDN about NT process and thread management. Hope this helps.

Kressilac


#3 Novalis   Members   -  Reputation: 122

Like
Likes
Like

Posted 09 February 2000 - 04:37 AM

I recommend you keep all your clients in one process. Here''s why...

Memory is cheap. CPUs are not. If you allocate a new thread for each client your CPU is eventually going to go kabloowey. If you use a queued approach response time will go down as clients increase but at least your CPU won''t. Just a thought.

#4 Jeremiah   Members   -  Reputation: 122

Like
Likes
Like

Posted 09 February 2000 - 04:37 AM

well, the server isnt going to run NT, but rather Linux.
The server will be something like a 433Mhz with 64Mb ram.

does Linux handle threads better?

and anyway, back to original question, has anybody made their own multiple user server? what suggestions: optimization, speed, security, would you give me?

The two servers Im planning on creating is a chat server, and a server where people can monitor an artificial creature in an artificial world.

#5 Jeremiah   Members   -  Reputation: 122

Like
Likes
Like

Posted 09 February 2000 - 04:39 AM

you''ve got a good point Novalis, thanx for the advice.

#6 Sphet   Members   -  Reputation: 631

Like
Likes
Like

Posted 09 February 2000 - 05:22 AM

everyone will try to tell you linux has better threads then NT. The fact is that you still have the same problems - multiple processes give you more CPU usage, NT or otherwise. I''ve written a couple of multi-user chat programs (telnet://www.rubyarts.org:2000). A lot of people complain about using select() with multiple ports, but that''s how I do it.

I have a linked list of all the clients, and I use select(), and iterate through my list, parsing the data one character at a time. Once I receive a carriage return, I check it against the state of the client,and then dispatch the string to my command dispatcher. This module parses the data and performs actions on it such as changing the user''s name, sending a private message or sending the string back to all the other users in the current ''channel. The nice thing about using select() is that you can easy make a NT/Linux portable program because WinSock has a pretty decent implementation of BSD sockets. I think I''ve only got a half dozen #ifdef WIN32''s in there. Granted, it runs in console mode, but it''s a server application - it doesn''t need to look good to the system operator.

#7 kressilac   Members   -  Reputation: 110

Like
Likes
Like

Posted 09 February 2000 - 07:33 AM

What Sphet described is the basics of SMAUG 1.4 underlying networking. Most if not all DikuMuds run this way. LPMuds run in a similar manner and are more C++ oriented, but since I have not had much experience with them, I can not speak confidently about them. It is an easy task to strip out everything in a MUD till all you have left is a game loop, command parser, and comm information. In Diku muds you will need mud.h, comm.h/c, interpreter.h/c, db.h/c, and a couple of other files like utils.h/c. Strip out anything that has to do with game play so you can get down to a chat server. From there you can add pieces to it to allow users presence in a world, and then give users control over what is instantiated in the world. Most of this code is already written, except for a different reason. With minor tweaking one could begin to accomplish what you are thinking of.

Kressilac


#8 Toom   Members   -  Reputation: 122

Like
Likes
Like

Posted 09 February 2000 - 07:51 AM

I don''t know if this is useful for you or not, but I put together some very basic socket code for UNIX platforms that shows how to start building a multi-user server.

It contains the basic socket specific stuff, all you really have to do is flesh it out. It could be evolved into a chat, a mud, or anything else you think of. It''s reasonably well commented and should be easy to follow. It''s also free with no strings attached. Compiles cleanly under Linux too.

http://www.islandnet.com/~toom

//TOOM

#9 Jeremiah   Members   -  Reputation: 122

Like
Likes
Like

Posted 09 February 2000 - 12:04 PM

I just want to thank everybody for thier very helpful posts.

This is a great place to come to share ideas, and help each other. Because, although the market may be a competitive field, I think every programmer ought to help out each other. This is what brings technology forward. Why should anybody hold onto a programming tip as their little secret, instead, share it with the world! I am sure you would want others to do this, and I thank you all for it.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS