473,320 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

urgent : program for server which handles multiple clients

Lecture Saying that:
I am generally expecting most of you to work n java.If you prefer to use c/c++ version of the programs,you may,but the assistance in the lab sessions will be very much geared towards java user.
compile both the client and the server programs.open two shell windows on different machines(using e.g ssh or putty to log into another machine).run the server onn one machine,then run the client on the another machine and let it connect to the server.type text into the client window and check whether it is indeed displayed in the server window.if you run the client and the serveron the same machine then use localhost as the address to which the client should connect.

YOUR TASK IS AS FOLLOWS :
The server is written in such a way that only one client can connect to it at any time.modify the server sothat several clients can be connected to it(and later disconnect from it) simultaneously.In other words,the server should be able to maintain open TCP connections to several clients.
when a client sends a string to the server ,the server should display the string and send it to all other clients that are currently connected it.each client should do two things: strings entered via the keyboard should be sent to the server, and strings received from the server should be displayed on the console.

SOME EXTRA INFORMATION:
There are two normal ways for dealing with several open connections: The most common method is to use threads(sothat each connection is handled by a different thread).An alternative is to use non-blocking i/o (sothat,for example,calling a function to receive data over a socket will not block indefinitely if no data arrives).
in java,facilities for non-blocking i/o are available in the java.nio.* packages.In particular ,the classes ServerSocketChannel and ServerChannel provide non-blocking TCP sockets ,and Selector can be used to wait for one of several sockets to change status.
In c/c++ , a socket can be put into non-blocking mode using fcntl. Waiting for one of several sockets to change status can be implemented efficiently using select or poll.
Refer to UNIX manpages for descriptions of the socket operations and operations such as select ,poll,fcntl etc. in c/c++ or refer to the java API documentation for information about the java.net and java.nio packages.
Oct 29 '08 #1
1 1827
Nepomuk
3,112 Expert 2GB
Great! Enjoy the task! Sounds like fun! ;-)

Seriously, we will not do your homework for you (as is stated here as part of our Posting Guidelines).

If you want help with your task, tell us what you've done so far and ask about a certain thing you're stuck with, preferably with some relevant code in your question.

Greetings,
Nepomuk
Oct 29 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Sidd | last post by:
Hi, I tried finding and example of multithreaded client-serve program in python. Can any one please tell me how to write a multithreaded client-server programn in python such that 1.It can handle...
34
by: Kovan Akrei | last post by:
Hi, I would like to know how to reuse an object of a thread (if it is possible) in Csharp? I have the following program: using System; using System.Threading; using System.Collections; ...
1
by: Yuri Ch | last post by:
Hi all, I'm quite new in C# and have no expirience in sockets. I have no idea how to implement the following app, but for expirienced developer, I suppose it should be very trivial... I have...
0
by: Macca | last post by:
Hi, I am writing an asychronous socket server to handle 20+ simulataneous connections. I have used the example in MSDN as a base. The code is shown at end of question. Each connection has a...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
2
by: =?ISO-8859-1?B?RulybmFz?= | last post by:
Hey all, I have a URGENT problem and I hope someone could help me... scenery: I have a windows app, coded using C# (framework 1.1 - VS2003)... The exe and dlls of the app is are stored in a...
1
by: kurrachaitanya | last post by:
YOUR TASK IS AS FOLLOWS : The server is written in such a way that only one client can connect to it at any time.modify the server sothat several clients can be connected to it(and later disconnect...
4
by: Veeraraghavan | last post by:
Hi All, I am developing a client server communication using system.net.socket and I am finding it very difficult to get a solution for this. I started with single port communication with single...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.