CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2006
    Posts
    13

    Client/Server Changing Password feature

    Hi..
    I want to add a change password feature to my client/server application using TCP.
    Normally, the change password feature has "Old Password", "New Password" and "Confirm Password" rite..?
    That means I need 3 text box and will be sending 3 different data at the same time..
    When sending only 1 data, for example, sending a data from client to server and put that data in a text box, that I know how to do.
    But when there are 3 different data sent at the same time from client to the server with 3 different text box to hold the data, how to make sure that the data go into the right text box in the server..?

    Below is the code that I have done.. It only send 1 data..
    The whole project is also attached below..

    Code:
    'Server
    Private Sub Form_Load()
    Form1.Visible = True
    Do
    If Winsock1.State <> sckConnected And Winsock1.State <> sckListening Then
    Winsock1.Close
    Winsock1.LocalPort = Text1.Text
    Winsock1.Listen
    End If
    DoEvents
    Loop
    End Sub
    
    Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
    Winsock1.Close
    Winsock1.Accept requestID
    Me.Caption = "Connection From: " & Winsock1.RemoteHostIP & " Accepted."
    End Sub
    
    Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
    Dim Data As String
    Winsock1.GetData Data
    Text2.Text = Data
    If Data = "END" Then End
    End Sub
    
    
    'Client
    Private Sub Command1_Click()
    On Error Resume Next
    Winsock1.Close
    Winsock1.RemoteHost = Text1.Text
    Winsock1.RemotePort = Text2.Text
    Winsock1.Connect
    End Sub
    
    Private Sub Command2_Click()
    Winsock1.Close
    Me.Caption = "Connection Closed."
    End Sub
    Private Sub Command3_Click()
    If Winsock1.State <> sckConnected Then Exit Sub
    Winsock1.SendData Text3.Text
    End Sub
    
    Private Sub Command4_Click()
    If Winsock1.State <> sckConnected Then Exit Sub
    Winsock1.SendData "END"
    End Sub
    Attached Files Attached Files

  2. #2
    Join Date
    Oct 2006
    Posts
    65

    Re: Client/Server Changing Password feature

    Concatenate your 3 text into 1 with any seperator (e.g ',-.) and do the reverse at the server side.

    Example:
    text3.text = oldpwd.text+","newpwd.text","newpwd2.text"
    send text3.text to server and split text3.text at server side.

    Umar

  3. #3
    Join Date
    Oct 2006
    Posts
    13

    Re: Client/Server Changing Password feature

    Quote Originally Posted by umararif
    Concatenate your 3 text into 1 with any seperator (e.g ',-.) and do the reverse at the server side.

    Example:
    text3.text = oldpwd.text+","newpwd.text","newpwd2.text"
    send text3.text to server and split text3.text at server side.

    Umar
    Thanks.. i think I understand what u mean.. but, how to I seperate the 3 infos fom text3 into 3 different text box when it reach the destination..?

  4. #4
    Join Date
    Oct 2006
    Posts
    65

    Re: Client/Server Changing Password feature

    You can use instr() and instrrev(), check attached project.

    Umar
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured