Socket programming in vb.net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kokwoei82
    New Member
    • May 2007
    • 2

    Socket programming in vb.net

    can socket programming in vb.net use for data transfer such as login data? all the samples that i found on internet is just a chat program. can someone show me some sample code on simple login for user name and password to be transfered from client to server? thanks in advance.
  • nitehawk416
    New Member
    • May 2007
    • 3

    #2
    Originally posted by kokwoei82
    can socket programming in vb.net use for data transfer such as login data? all the samples that i found on internet is just a chat program. can someone show me some sample code on simple login for user name and password to be transfered from client to server? thanks in advance.

    I'm not sure at client side, but in c# I connect to a server end database through a telnet connection, and I have a text box that submits my text commands to the server, and It accepts my user and password that way. Although it prompts me for user first, I submit that, then it prompts for password, and I submit that next. I was thinking of having it submit it in a different form, and I thought the easiest way to do it would be to input the username and password, then when you click submit, it would submit the data stored in two seperate variables in sequential order. I'm not sure if that would work for your application though.

    Comment

    • darkmannofear
      New Member
      • Apr 2007
      • 18

      #3
      ummmmmmm look you can send it using socket programming, but you have to build messaging policy between the client and the server (as protocols do, you put a header for your message to tell the server what is the content of this message and according to this header you do some task) for example you build a string like "USRNAME=BLABLA BLA" and send it to the server ,"PASSWORD=BLAB LABLABLA" and send it to the server.
      and as sockets send array of bytes use Encoding.ASCII. GetBytes(yourst ring); this will retrive the array of bytes for you send this array of bytes from the client.

      Note: you can build only one message "username=blabl abla~~password= blabla"

      At the Server make a byte[] of suffient size for example [1024] = 1 KB. and receive this the incoming bytes in this array by using Encoding.ASCII. GetString(byte[]); retrive the string that was sent from the client.
      At the server you have to perform some processing on this string to extract the information included in it, string.split(.. ...), string.substrin g(.....) all of this is traditional programming and easily i think you can perform it.

      if you want to secure your message you can use encryption to encrypt all of your string.
      and on the other end decrypt it using different encryption algorithms provided by .Netframework at System.Net.Secu rity namespace

      does this help?

      Comment

      • kokwoei82
        New Member
        • May 2007
        • 2

        #4
        I was able to send user name and password to the server side for processing now with the split function. but i was thinking to send some bigger size of data such as dataset or reports.... any idea on doing this? thanks again for above 2 answers.

        Comment

        • sekarm
          New Member
          • Mar 2007
          • 26

          #5
          Thanks Guyz,
          I have also searching the idea for the aboce thinks. can u show the code or link for above requirements.it s very useful for me.

          Thanks In Advance,
          Sekar.M

          Comment

          • darkmannofear
            New Member
            • Apr 2007
            • 18

            #6
            umm i'm not sure about it but you can use object serlialization and deserlization to send some data from one node to another.
            Search at Microsoft MSDN about serlization basic you will get an easy way to serlize objects and get byte[] to be sent over the network

            Comment

            Working...