Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
Homework Assignment # 1 CMPSC 176a – HOMEWORK ASSIGNMENT 2 DUE: OCTOBER 25TH (By 11:59pm) Objective There are a number of objectives to this assignment beyond just a simple socket programming assignment. First, if you have not ever programmed sockets before, it is relatively straightforward, but still an effort. It is worthwhile to have everyone on the same page in terms of experience, at least in this respect. Second, it will help you “tune up” your programming skills and prepare you for other upper-division networking courses. Third, because you can use the Internet to look for examples, this assignment will help you see just how many network programming aids are out in the Internet. And finally, having some practical experience will put a lot of the protocol concepts we learn into perspective. Assignment The goal of this assignment is to implement a TCP client and server, and a UDP client and server (that’s four different programs all told). You can use either C or Java. Your TCP or UDP client/server will communicate over the network and exchange data. The server will start in passive mode listening for a transmission from the client. The client will then start and contact the server (on a given IP address and port number). The client will pass the server a string (eg: “network”) up to 80 characters in length. On receiving a string from a client, the server should: 1) reverse all the characters, and 2) reverse the capitalization of the strings (“network” would now become “KROWTEN”). The server should then send the string back to the client. The client will display the received string and exit. Example Starting the server: Assume that you started a server on machine 128.111.49.44, listening to port number 32000. The syntax should look like the following: csil-machine1> server 32000 (in this line, “server” will be replaced by one of the names given below in the Submission Section) Starting the client: csil-machine2> client 128.111.49.44 32000 (in this line, “client” will be replaced by one of the names given below) Enter text: This is my text to be changed by the SERVER Response from server: revres EHT YB DEGNAHC EB OT TXET YM SI SIHt csil-machine2> At this point (after receiving one line to be reversed), the server and client should both exit. Submission Choose either Java or C. For C Programmers: Your task is to write the server and client programs in C using UDP and TCP. You will turn in 4 different programs. Server in C using UDP     (file name to turn in : server_c_udp.c) Client in C using UDP        ( file name to turn in : client_c_udp.c) Server in C using TCP        ( file name to turn in : server_c_tcp.c) Client in C using TCP        (file name to turn in : client_c_tcp.c) For Java Programmers: Your task is to write the server and client programs in Java using UDP and TCP. You will turn in 4 different programs. Server in Java using UDP     (file name to turn in : server_java_udp.java) Client in Java using UDP        (file name to turn in : client_java_udp.java) Server in Java using TCP        (file name to  turn in : server_java_tcp.java) Client in Java using TCP        (file name to turn in : client_java_tcp.java) PLEASE NOTE: Only these 4 files need to be turned in. No header files or output files should be submitted. Your server should not output anything on the terminal and your client should have the exact same interface as given in the above example. Code will be run against an automated checker and any deviation (e.g. printing additional messages) will be counted as an incorrect program. COMPILING YOUR CODE: In order to compile your C code, use the following commands as a guide: gcc -g -o client client.c -lsocket –lnsl gcc -g -o server server.c -lsocket To compile your Java code, use the following commands as a guide: javac server_java_udp/tcp.java javac client_java_udp/tcp.java To run your Java code on the CSIL machines, use the following commands as a guide: java server_java_udp 32000 java client_java_udp 128.111.49.44 32000 TURNIN: The assignment is due on Oct 25th by 11:59pm. Late submissions will not be accepted. Please include your name and Perm# and Email Address in each program file you submit (as a comment). To turn in the assignment, use the following command from the Computer Science CSIL lab: csil-machine> turnin homework2@cs176a hw2 NOTE: The “hw2" should be a local directory containing the 4 (and only 4) programs you are turning in. Be certain to name this directory exactly "hw2". It is highly recommended that you use the CSIL machines to do this assignment. All of the tools you will need are available there; it significantly improves our ability to help you if you have problems; and it ensures that if your programs work there, they will work when we grade them. Grading Guidelines In addition to correctness, part of the points count towards how well code is written and documented. NOTE: good code/documentation does not imply that more is better. The goal is to be efficient, elegant and succinct! 20 pts: UDP client 20 pts: TCP client 25 pts: UDP server 25 pts: TCP server 10 pts: Documentation/Proper References Resources/Help You may use pieces of code from the Internet to help you do the assignment. You will not be negatively graded for using such code snippets as long as they are properly cited. Please email/meet the TAs if you need any help or guidance with your assignment.