Protocols

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ANGELSDAGGER
    New Member
    • Aug 2007
    • 14

    #1

    Protocols

    If you're sending something down a socket in Winsock (VB.NET), does anyone know how to add the protocol tags?

    i.e.

    socket.SendData (Usname & "|" & pass) <<< I have this but I need the server to identify what kind of data is being sent. I was told to you protocols such as

    EHLO and MAIL.

    Anyone know?
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Firstly, what are you trying to do exactly?

    EHLO and MAIL are all commands in the smtp protocol (which can be googled to find the RFC explaining it)

    And generally anything with a password (in smtp and actually http) is sent base64 encoded.

    Comment

    • ANGELSDAGGER
      New Member
      • Aug 2007
      • 14

      #3
      My program was working fine, but my lecturer said to me that the server has to be able to identify the type of message being sent and you do this using protocols. But I'm thinking if it ain't broke, don't fix it.

      Though I am now getting an error in my socket.SendData statement.

      Exception from HRESULT: 0x800A9C46

      As soon as I type the username and password in I get that error. I will post the code here for you to look at.

      Code:
      Imports MSWinsockLib.ProtocolConstants
      Imports MSWinsockLib.StateConstants
      Imports MSWinsockLib
      
      Class Form1
      
          Dim WithEvents socket As New Winsock
      
          Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
              '* Local Machine Properties.
      
              '*Set the port.
              socket.RemotePort = 1001
              socket.RemoteHost = "192.168.0.171"
              '* Now connect
              socket.Connect()
          
      
      
          End Sub
      
          Private Sub socket_DataArrival(ByVal bytesTotal As Integer) Handles socket.DataArrival
              '* Invoke getdata maethod and put data into a string
              '* named strdata
              Dim strdata As String = ""
              socket.GetData(strdata, vbString)
              Form2.lstbox5Entries.Items.Add(strdata)
              Show(Form2)
          End Sub
      
      
          Private Sub btnEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnter.Click
      
      
              Dim pass As String
              Dim Usname As String
              pass = txtboxPassword.Text()
              Usname = txtboxUsrName.Text()
              MsgBox(Usname)
             [B] socket.SendData(Usname & "|" & pass)[/B]
              txtboxUsrName.Text = ""
              txtboxPassword.Text = ""
          End Sub
      End Class

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        I am unfamiliar with that kind of error since it's related to VB and not VB.NET.
        You could try having someone move your question there for better assistance.

        Comment

        Working...