Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Servidor
- while (protocolSI.GetCmdType() != ProtocolSICmdType.EOT)
- {
- networkStream.Read(protocolSI.Buffer, 0, protocolSI.Buffer.Length);
- if (protocolSI.GetCmdType() == ProtocolSICmdType.USER_OPTION_2)
- {
- string usernamestring = null;
- string pass = null;
- usernamestring = protocolSI.GetStringFromData();
- Console.WriteLine("Attempt to login from" + usernamestring);
- networkStream.Read(protocolSI.Buffer, 0, protocolSI.Buffer.Length);
- if (protocolSI.GetCmdType() == ProtocolSICmdType.DATA)
- {
- pass = protocolSI.GetStringFromData();
- }
- IsClientLoggeIn = logReg.VerifyLogin(usernamestring, pass);
- }
- }
- //cliente
- ProtocolSI protocolSI = new ProtocolSI();
- string username = textBoxUsername.Text;
- string password = textBoxPassword.Text;
- byte[] userpacket = protocolSI.Make(ProtocolSICmdType.USER_OPTION_2, username);
- networkStream.Write(userpacket, 0, userpacket.Length);
- byte[] passpacket = protocolSI.Make(ProtocolSICmdType.DATA, password);
- networkStream.Write(passpacket, 0, passpacket.Length);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement