Dec 6, 2008

IT 421 - Client Server Requirements

IT 421 – Client Server Programming for the month of December

Programming using visual basic 6.0 is not just creating designs and inserting codes into the controls, but also analyzing the codes to come up with the correct designs. This activity will enhance your analyzes skill and this activity will serve as your laboratory activity number 2. As much as the subject is concerned, it is assumed that the following systems contain client and server. Analyze the code and answer the questions that follow after it. This is individual.

CLIENT SERVER SYSTEMS Activity 2

Instructions:

  1. Create a vb project for Server system and another (separate) project for Client System.
  2. Add the tool/control Microsoft Winsock 6.0 in your toolbox from your project components.
  3. Drag the added control to your server and client project forms.
  4. Create the design as shown below, and input the codes.

SYSTEM 1

Controls Description

Label1 = Message to the client

Label2 = Message from the client

Text1 = txtSenderMsg

Text2 = txtReceiverMsg

Text1 Multiline = True

Text1 ScrollBars = Vertical

Text2 Multiline = True

Text2 ScrollBars = Vertical

Winsock1 = wsckServer

Command1 = cmdSend

Codes

Private Sub cmdSend_Click()

Dim msg As String

msg = txtSenderMsg

wsckServer.SendData msg

End Sub

Private Sub Form_Activate()

wsckServer.LocalPort = "1001" 'any number defined as a Port Number as same as in the Client Program

wsckServer.Listen

End Sub

Private Sub Form_Terminate()

wsckServer.Close

End Sub

Private Sub wsckServer_ConnectionRequest(ByVal requestID As Long)

If wsckServer.State <> sckClosed Then wsckServer.Close

wsckServer.Accept requestID

End Sub

Private Sub wsckServer_DataArrival(ByVal bytesTotal As Long)

Dim msg As String

wsckServer.GetData msg

txtReceiverMsg = msg

End Sub

SYSTEM 2

Controls Description

Label1 = Message to the Server

Label2 = Message from the server

Text1 = txtSenderMsg

Text2 = txtReceiverMsg

Text1 Multiline = True

Text1 ScrollBars = Vertical

Text2 Multiline = True

Text2 ScrollBars = Vertical

Winsock1 = wsckServer

Command1 = cmdSend

Codes

Private Sub optConnect_Click()

End Sub

Private Sub optDisConnect_Click()

wsckClient.Close

optConnect.Enabled = True

optDisconnect.Enabled = False

txtSenderMsg.Enabled = False: txtReceiverMsg.Enabled = False

End Sub

Private Sub Form_Activate()

wsckClient.RemoteHost = "192.168.1.138"

wsckClient.RemotePort = "1001

wsckClient.Connect

End Sub

Private Sub wsckClient_DataArrival(ByVal bytesTotal As Long)

Dim msg As String

wsckClient.GetData msg

txtReceiverMsg = msg

End Sub

Private Sub cmdSend_Click()

On Error GoTo last

wsckClient.SendData txtSenderMsg

Exit Sub

last:

If Err.Number = 40006 Then

MsgBox "Not connected, Try again"

End If

End Sub

Private Sub Form_Terminate()

wsckClient.Close

End Sub

Questions:

  1. Determine which is the Client System and the Server System from two systems presented above. Why? Justify your answer.
  2. From question 1, create the DESIGN (illustrate) for Client and for Server.
  3. Discuss how the controls and its equivalent descriptions being performed for the client and the server system. Example: Label1 = Message to the Client. Why does it set as shown, where should I perform it? E.g. design window mode, code window, property window, explorer window and etc. Step-by-step explanation is encouraged.
  4. Discuss the general performance of the systems. How these perform things. What’s the role of client to the server and vice versa?
  5. Discuss the scope of the systems. Is it specified command or user-defined command and etc.
NOTE: No text and paragraph formats required, but don’t forget the FrontPage which will contains the names of students, course, date submitted, subject Description and the words “ANSWERS TO QUESTIONS”. Submit your computerized clear answers on a maximum of 10 but not less than 8 pages plain papers (excluding the frontpage) before CHRISTMAS VACATION. No answers will be marked ZERO for this undertaking. STRICTLY: Late papers will not be accepted. Stapled papers will be good enough; do not place it in folder. Make use of your 2-weeks time wisely. Please follow instructions (as stated line-by-line in this paragraph). God Bless.

No comments: