borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (sending of pictures in LAN)Next Topic (Winsock) New Topic New Poll Post Reply
AndreaVB Forum : Network : Username and Password with winsock
Poster Message
millerdraft
Level: Scholar

Registered: 01-02-2003
Posts: 41

icon Username and Password with winsock

Sorry everyone I put this in the wrong spot before.  Please let me know if you can help me with this.

I have a program that I need to allow others to login to the program.  I have the client form set to connect on form load.
Then when the click login in this is the code that I have for that.
Private Sub cmdLogIn_Click()
    StrData = txtIDNumber.Text
    wskServer.SendData txtIDNumber.Text
    DoEvents
    StrData = txtPassword.Text
    wskServer.SendData txtPassword.Text
End Sub

Then that sends the info to the Server form.  When that receives the data it has this as the code.  The winsock on the server is an array.  As to allow multiple connections.

dim intConnection as integer

Private Sub wskServer_DataArrival(Index As Integer, ByVal bytesTotal As Long)
    DoEvents
    wskServer(intConnection).GetData StrData, vbString
    txtIDNumber.Text = StrData
    DoEvents
    wskServer(intConnection).GetData StrData, vbString
    txtPassword.Text = StrData
    DoEvents
End Sub

I am trying to figure out what I am doing wrong.  Can I send the info like that?  I have done that before or at least I am pretty sure that I have.   Any help would be greatly appreciated.  Many thanks in advance.

Ted

[Edited by millerdraft on 12-05-2003 at 09:58 AM GMT]

____________________________
Ted Moe
I wish I was real good at this stuff!

12-05-2003 at 10:49 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
andrea_deleon
Level: Guest

icon Re: Username and Password with winsock

If I'm going to do it, I'll include a code in every message I send between client and server. So, for every message I receive, I'll take the code first to determine what this data (message) is all about.
If I'm going to do it, I'll do it something like...

' Client program precedes username code "#uname" to the actual username data and send the message to the server.

StrData = "#uname" & txtIDNumber.Text

' sending password...
StrData = "#pword" & txtPassword.Text


'At the server side, all the messages received by the server will be checked first to determine the received message...

'assuming all codes are of 6 bytes, remove the first 6 bytes from the message and store it to, say, vMyCode, and ...

select case vMyCode ' use if statement if this usage is wrong

  case "#uname": 'process username received
  case "#pword": 'process password received
  case "#adata": 'process data

Or maybe, for data, there will be no code hence first letter of message received/sent has no # sign. Only messages for command and synchronization (software side) will have a code and data wouldn't.

I'm not very good in winsock. For the "experts", please give a guide on how to do this properly.

10-07-2003 at 06:22 PM
| Quote Reply
AndreaVB Forum : Network : Username and Password with winsock
Previous Topic (sending of pictures in LAN)Next Topic (Winsock) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder