Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

I've got my problem narrowed down to the Auth Login (in VB.Net). This is the only problem I am having. I can't figure out how to properly convert the the byte to base64 encoding (VB.Net) to send.

 

Public Function Open()

client.Connect(_server, _port)

ns = client.GetStream()

 

Dim strMessage As String = "HELO" & ControlChars.CrLf

Dim sendBytes As [byte]() = Encoding.ASCII.GetBytes(strMessage)

ns.Write(sendBytes, 0, sendBytes.Length)

 

Dim StrMessage2 As String = "Auth Login" & ControlChars.CrLf

Dim sendBytes2 As [byte]() = Encoding.ASCII.GetBytes(StrMessage2)

ns.Write(sendBytes2, 0, sendBytes2.Length)

 

Dim ConvertBytes3

ns = client.GetStream()

Dim StrMessage3 As String = "User " & _Username & ControlChars.CrLf

Dim sendBytes3 As [byte]() = (Encoding.ASCII.GetBytes(StrMessage3))

ConvertBytes3 = Convert.ToBase64String(sendBytes3)

ns.Write(ConvertBytes3, 0, ConvertBytes3.Length)

 

Dim ConvertBytes4

Dim StrMessage4 As String = "Pass " & _Username & ControlChars.CrLf

Dim sendBytes4 As [byte]() = Encoding.ASCII.GetBytes(StrMessage4)

ConvertBytes4 = Convert.ToBase64String(sendBytes4)

ns.Write(ConvertBytes4, 0, ConvertBytes4.Length)

 

 

End Function

Edited by Sylonious
Posted

My client.Getstream.Write does not work with strings. What do I use to write the response back to the server?

 

This only wokred with Bytes.

ns = client.GetStream()

ns.Write(sBase64, 0, sBase64.Length)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...