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.
Socket programming in vb.net
Collapse
X
-
Originally posted by kokwoei82can 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. -
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
-
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 networkComment
Comment