Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

network project using java programing

Status
Not open for further replies.

eng.j.u.s.t

Newbie level 5
Joined
Oct 27, 2008
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,375
java networking projects

hi to all
i want to implement this project in Java:
Read about sockets in java at java.sun.com/docs/books/tutorial/networking/sockets/index.html
Read about package "java.net" at java.sun.com/j2se/to learn about trapping network exceptions and timers.
Install and execute Chapter 2's TCP and UDP client-servers. Note: the java programs can be cut and pasted from the course website.
If you chose to implement your project in C:
Read about C socket programming from Beej's guide to network programming.
Install and execute sample TCP and UDP client-servers. Note that C programs for this can be cut and pasted from client-server section of Beej's guide.



A simple message relay application:

In this programming assignment you will program the simple message relay application shown below:




sender -------------> message relay ---------> receiver




The sender process accepts user-entered "messages" from the keyboard, and sends these messages to the receiver process via the message-relay process. The receiver process displays a message once the message has been received in its entirety. All communication among the processes is done using TCP sockets. There are two application-level messages defined: a DATA message (containing the text of a message) and a CLOSE message, which instructs the receiver of the CLOSE message to shut down, as discussed below

Sender process. The sender process accepts user-entered "messages" (e.g., containing characters entered by the user via keyboard) and sends each message to the relay and then waits for another user-entered message. You can use whatever convention you want for user to indicate that an input message is complete. Note that because of the btye-stream semantics of the TCP socket, your sender process will need to define a application-layer DATA message that lets the relay process know how many characters are in the incoming byte stream. When the user indicates that there are no more messages to send (use whatever convention you want to allow the user to indicate this as well), the sender process should send a CLOSE message to the intermediate relay, and then terminate itself gracefully (i.e., releasing any sockets it has been using).
Intermediate-relay process. After establishing a connection with the sender and receiver processes, this process reads messages sent by the sender process. It forwards DATA messages to the receiver process over a TCP socket. When the intermediate relay receives a CLOSE message from the sender process, it should send a CLOSE message to the receiver process, and then gracefully terminate itself.
Receiver process. This process reads messages sent by the intermediate-relay process. It displays the content of each DATA message once that message has been received in its entirety. On receipt of a CLOSE message, the receiver process should terminate itself gracefully.
Since the goal of the programming assignment is for you to learn socket programming (not to build a hardened application), you can hardwire in specific IP addresses where the processes are known to be running (i.e., you need not somehow ask the user for the host names or IP addresses of the process to which messages will be sent). You may also assume that the relay and the receiver will only be receiving messages from a single sender or relay, respectively. The extra credit option (i.e., not required) for this assignment asks you to program a relay that can handle multiple senders concurrently.

Please read the information posted on the class WWW site about what to hand with your assignment. Note that a short design document is required. You should program your each process to print an informative statement whenever it takes an action (e.g., sends or receives a message, detects termination of input, etc), so that you can see that your processes are working correctly (or not!). This also allows the TA to also determine from this output if your processes are working correctly. You should hand in screen shots (or file content, if your process is writing to a file) of these informative messages.

Programming notes

Here are a few tips/thoughts to help you with the assignment:

You must chose a server port number greater than 1023 (to be safe, choose a server port number larger than 5000).
I would strongly suggest that everyone begin by writing the sender and relay processes first, i.e., just getting the two of them to interoperate corrections. Then modify the relay and program the receiver.
You will need to know your machine's IP address, when one process connects to another. You can telnet to your own machine and seeing the dotted decimal address displayed by the telnet program. You can also use the UNIX nslookup command or you can ask your local system administrator for the info.
Many of you will be running the sender, relay, and receiver on the same UNIX machine (e.g., by starting up the receiver and running it in the background, then starting up the relay in the background, and then starting up the sender. This is fine; since your using sockets for communication these processes can run on the same machine or different machines without modification. Recall the use of the ampersand to start a process in the background. If you need to kill a process after you have started it, you can use the UNIX kill command. Use the UNIX ps command to find the process id of your server
Make sure you close every socket that you use in your program. If you abort your program, the socket may still hang around and the next time you try and bind a new socket to the port ID you previously used (but never closed), you may get an error. Also, please be aware that port ID's, when bound to sockets, are system-wide values and thus other students may be using the port number you are trying to use.
Code:
Code:
 

Check the book Head First Java 2nd Edition by Kathy Sierra&Bert Bates
more specific Chapter 15 , its implementing something if not the same that you asked for.

I hope i helped.Even ig its 1 year later from your post :p
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top