代写Programming Assignment 2调试Java编程

Programming Assignment 2

Objective of this assignment:

•    Develop and implement in your preferred language a simple application using  UDP and TCP sockets. The application using UDP sockets must be developed for this Programming Assignment 2.  The application using TCP sockets will be due for Programming Assignment 3. Insure the language is already available on Tux machines. It is your responsibility to check.  10 bonus if client and server are developed with different languages.

What you need to do:

1.   Implement a simple UDP Client-Server application (Programming Assignment 2)

2.    Implement a simple TCP Client-Server application (Programming Assignment 3)

Objective:

The objective is to implement a client-server application using a safe method: start from a simple working code for the client and the server. You must slowly and carefully bend (modify) little by little the client and server alternatively until you achieve your ultimate goal. You must bend and expand each piece alternatively the way a black-smith forges iron. From time to time save your working client and server such that you can roll-back to the latest working code in case of problems. Failing to follow this incremental approach may result in a ball of wax impossible to debug in case your program does not behave or work as expected.

If you plan to use Java for this programming assignment, you are advised to start from the Friend client and server application to implement the calculator server. You will first implement the calculator server using UDP (Programming Assignment 2), and then TCP (Programming Assignment 3). If using a language other than Java, you are on your own. Insure that you preferred language is already available on Tux machines. It is your responsibility to check.

Part ADatagram socket programming (Programming Assignment 2)

The objective  is to design a  Calculating Server (CS). This calculating server  performs  bitwise  boolean and arithmetic computations requested by a client on  16-bit signed integers. Your server must offer the following operations:

1) addition (+), 2) subtraction (-), 3) bitwise OR (|), 4) bitwise AND (&), 5) division, and 6) multiplication.

client request will have the following format:

Field

TML

Operand 1

Op Code

Operand 2

Request ID

Size (bytes)

1

2

1

2

2

Where

1)   TML is the Total Message Length (in bytes) including TML. It is an integer representing the total number of bytes in the message.

2)   Request ID is the request ID. This number is generated by the client to differentiate requests. You may use a variable randomly initialized and incremented each time a request is sent.

3)   Op Code is a number specifying the desired operation following this table

Operation

+

-

|

&

/

*

OpCode

0

1

2

3

4

5

4)   Operand  1: this number is the first or unique operand for all operations.

5)   Operand 2: this number is the second operand.

Operands are sent in the network byte order (i.e., big endian).

Hint: create a class object Request like "Friend", but with the information needed for a request.....

Below are two examples of requests

Request 1: suppose the Client requests to perform. the operation 240 + 4: (This is the 5th request)

0x08

00x

0xF0

0x00

0x00

0x04

0x00

0x05

Request 2: suppose the Client requests to perform. the operation 240 –  160  (if this is the 9th  request):

0x08

0x00

0xF0

0x01

0x00

0xA0

0x00

0x09

The Server will respond with a message with this format:

Total Message Length (TML)

Result

Error Code

Request ID

one byte

4 byte

1 byte

1 byte

Where

1)   TML  is the Total Message Length (in bytes) including TML. It is an integer representing the total numbers of bytes in the message.

2)   Request ID is the request ID. This number is the number that was sent as Request ID in the request sent by the client.

3)   Error Code is 0 if the request was valid, and  127 if the request was invalid (Length not matching TML).

4)   Result is the result of the requested operation.

In response to Request 1 below

0x08

0x00

0xF0

0x00

0x00

0x04

0x00

0x05

the server will send back:

0x07

0x00

0x00

0x00

0xF4

0x00

0x05

In response to Request 2,

0x08

0x00

0xF0

0x01

0x00

0xA0

0x00

0x09

the server would send back:

0x07

0x00

0x00

0x00

0x50

0x00

0x09

a)   Repetitive Server: Write a datagram Calculating Server (ServerUDP.xxx) in your preferred

language. This server must respond to requests as described above. The server must bind to port (10010+TID) and could run on any machine on the Internet. TID is your Canvas team #. The server must  accept a command line of the form.: prog ServerUDP portnumber  where prog  is the executable, portnumber is the port the server binds to. For example, if your Team ID (GID) is Team 13 then your server must bind to Port #  10023.

Whenever a server gets a request, it must:

i.   print the request one byte at a time in hexadecimal (for debugging and grading purpose)

ii.   print out the request in a manner convenient for a typical Facebook user: the request ID and the request (operands and required operation)

b)   Write a datagram client (ClientUDP.xxx) in your preferred language:

i.   Accepts a command line of the form.: prog ClientUDP servername PortNumber where prog is the executable, servername is the server name, and PortNumber is the port number of the server. Your program must prompt the user to ask for an Opcode, Operand1 and Operand2 where OpCode is the opcode of the requested operation (See the opcode table). Operand1 and Operand2 are the operands. For each entry from the user, your program must perform. the following operations:

ii.   form a message as described above

iii.   send the message to the server and wait for a response

iv.   print the message one byte at a time in hexadecimal (for debugging and grading purpose)

v.   print out the response of the server in a manner convenient for a typical Facebook user: the request ID and the response

vi.   print out the round trip time (time between the transmission of the request and the reception of the response)

vii.   prompt the user for a new request.

Part B: TCP socket programming (Due for Programming Assignment 3)

Repeat part A using TCP sockets to produce (ServerTCP.xxx, ClientTCP.xxx).

How to get started (If using Java)?

1) Download all files (UDP sockets) to run the "Friend" application used in Module 2 to illustrate how any class object can be exchanged: Friend.java, FriendBinConst.java, FriendDecoder.java, FriendDecoderBin.java, SendUDP.java, and RecvUDP.java.

2) Compile these files and execute the UDP server and client. Make sure they work

3) Create a new folder called Request and duplicate inside it ALL files related to the Friend class object

4) Inside the Folder Request, change ALL occurrences of "Friend" with "Request" including the file names.

3) Adapt each file to your calculator application. Replace the fields used by Friend with the fields used by a request.

4) Aim to have the client send one request and have the server understand it (just like what we did with a friend object).

5) When your server will receive and print out correctly a request, then you need to send back a response...

6) Create a class object Response....

Report

•    Write a report. The report must include screenshots of the client and the server. We must see on the screenshot of the client four successful requests for the operations - (subtraction), I (or), & (and), and *. To receive any credit, the screenshots must clearly show the Tux machine, the username of one of the classmates, and the date. To get the date, just run the command date before executing your client or server. Each missing screenshot will result in a 25 points penalty. Your screenshot should have the information on this template:


•      If your program does not work, explain the obstacles encoutered.

What you need to turn in:

•     Electronic copy of all your source programs (submit them on Canvas separately).

•      In addition, put all the source programs in a folder that you name with your concatenated last name and first name. Zip the folder and submit the zipped folder TOO. The grader should see on Canvas all your source programs separately AND a zip folder containing all the source programs needed to compile and execute your program.

•     Electronic copy of the report (including your answers) (standalone). Submit the file as a Microsoft Word or PDF file.

Grading

1) UDP/TCP client is worth 40% if it works well: communicates with YOUR server. Furthermore, screenshots of your client and server running on Tux machines must be provided. The absence of screenshots or screenshots on machines other than the Tux machines will incur a 15% penalty.

2) UDP/TCP client is worth 10% extra if it works well with a working server from any of your classmates.

1) UDP/TCP server is worth 40% if it works well: communicates with YOUR client. Furthermore, screenshots of your client and server running on Tux machines must be provided. The absence of screenshots or screenshots on machines other than the Tux machines will incur a 15% penalty.

2) UDP/TCP server is worth 10% extra if it works well with a working client from any of your classmates.


热门主题

课程名

mktg2509 csci 2600 38170 lng302 csse3010 phas3226 77938 arch1162 engn4536/engn6536 acx5903 comp151101 phl245 cse12 comp9312 stat3016/6016 phas0038 comp2140 6qqmb312 xjco3011 rest0005 ematm0051 5qqmn219 lubs5062m eee8155 cege0100 eap033 artd1109 mat246 etc3430 ecmm462 mis102 inft6800 ddes9903 comp6521 comp9517 comp3331/9331 comp4337 comp6008 comp9414 bu.231.790.81 man00150m csb352h math1041 eengm4100 isys1002 08 6057cem mktg3504 mthm036 mtrx1701 mth3241 eeee3086 cmp-7038b cmp-7000a ints4010 econ2151 infs5710 fins5516 fin3309 fins5510 gsoe9340 math2007 math2036 soee5010 mark3088 infs3605 elec9714 comp2271 ma214 comp2211 infs3604 600426 sit254 acct3091 bbt405 msin0116 com107/com113 mark5826 sit120 comp9021 eco2101 eeen40700 cs253 ece3114 ecmm447 chns3000 math377 itd102 comp9444 comp(2041|9044) econ0060 econ7230 mgt001371 ecs-323 cs6250 mgdi60012 mdia2012 comm221001 comm5000 ma1008 engl642 econ241 com333 math367 mis201 nbs-7041x meek16104 econ2003 comm1190 mbas902 comp-1027 dpst1091 comp7315 eppd1033 m06 ee3025 msci231 bb113/bbs1063 fc709 comp3425 comp9417 econ42915 cb9101 math1102e chme0017 fc307 mkt60104 5522usst litr1-uc6201.200 ee1102 cosc2803 math39512 omp9727 int2067/int5051 bsb151 mgt253 fc021 babs2202 mis2002s phya21 18-213 cege0012 mdia1002 math38032 mech5125 07 cisc102 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 math21112 efim20036 mn-3503 fins5568 110.807 bcpm000028 info6030 bma0092 bcpm0054 math20212 ce335 cs365 cenv6141 ftec5580 math2010 ec3450 comm1170 ecmt1010 csci-ua.0480-003 econ12-200 ib3960 ectb60h3f cs247—assignment tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 math350-real math2014 eec180 stat141b econ2101 msinm014/msing014/msing014b fit2004 comp643 bu1002 cm2030
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图