You are on page 1of 3

Programming assignment: simple TCP / IP client - performance test

1. Description:
A TCP/IP Client of a given binary protocol should be implemented. The protocol defines login, logout and error frames. The connection must be established by way of a TCP/IP Socket . The client should be used as the foundation for a performance test with the following criteria: Parallel login and logout for 1.000 client connections. Logging of a login/logout roundtrip time of one client connection. Calculation of the average login/logout time for all parallel client connections.

Demo server address: IP: 194.208.27.222 Port: 8081

2. Protocol
2.1 Instruction The Protocol frames will be sent as a binary block. The byte order is little-endian. The header-information MessageType, SessionId and BodyLength are always required. These fields define the header of the frame and all other fields define the body. All strings are encoded in UTF-8 and case-sensitive. The SessionId has to be the same value as the SessionId from the Login Response. The BodyLength is the sum of the length of all following fields (body of the frame). 2.2 Sequence Establish TCP/IP connection to the server Send Login Request Retrieve Response Send Logout Request 2.3 Frames 2.3.1 Login Request Field Type MessageType Int32 SessionId GUID BodyLength Int64 Id String UserLength Int32 User String PasswordLength Password Int32 String

Length 4 Byte 16 Byte 8 Byte 6 Byte 4 Byte Defined by UserLength 4 Byte Defined by PasswordLength

Required Yes Yes Yes Yes Yes Yes Yes Yes

Description: MessageType = 1 The Id has to be set with your authentication Id. The SessionId has to be an empty GUID ( Text Representation: 00000000-0000-0000-0000-000000000000) in binary representation. Definition of a GUID: [Globally unique identifier - Wikipedia, the free encyclopedia] Binary Representation of a GUID: Bits Bytes Description 32 4 Data1 16 2 Data2 16 2 Data3 64 8 Data4 2.3.2 Login Response Field MessageType SessionId BodyLength Success ErrorLength Error

Endianness Big Big Big Big

Type Int32 GUID Int64 Bool Int32 String

Length 4 Byte 16 Byte 8 Byte 1 Byte 4 Byte Defined by ErrorLength

Required Yes Yes Yes Yes Yes No

Description: MessageType =2 The SessionId of the Login Response is the session identifier for all other frames. 2.3.3 Logout Request Field MessageType SessionId BodyLength Id LogoutCode MessageLength Message

Type Int32 GUID Int64 String Int32 Int32 String

Length 4 Byte 16 Byte 8 Byte 6 Byte 4 Byte 4 Byte Defined by MessageLength

Required Yes Yes Yes Yes Yes Yes No

Description: MessageType=3 The Id has to be set with your authentication Id. The SessionId has to be the value of the Login Response. The LogoutCode has to have the value 1. The Message is optional. 2.3.4 Error Frame Field MessageType

Type Int32

Length 4 Byte

Required Yes

SessionId BodyLength ErrorCode MessageLength Message

GUID Int64 Int32 Int32 String

16 Byte 8 Byte 4 Byte 4 Byte Defined by MessageLength

Yes Yes Yes Yes No

Description: MessageType=4 The Message field contains details of the error.

2.4 Exceptions If a message header couldnt be read, no message will be returned. If the authentication fails, an Error Frame will be returned. If the Login fails, an LoginResponse with the Error Message will be returned. If a Frame with a unknown MessageType has been send, an Error Frame will be returned. If the SessionId isnt the same as the SessionId from the Login Response, an Error Frame will be returned. If the LogoutCode is not 1, an Error Frame will be returned.

3. Available Users
You could use one of the following users or all for a Login Requests. User Plato Nietsche Confucius Descartes Password Dfedl1285! Jdkiel3849? D9348djiex$ 930eidkfrq%

You might also like