Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C#2.0 C#3.0 C# C#4.0
Hi guys,
I need to login to my server, and got as far as creating the connection. But how do I pass a username and password?
TcpClient tcpclient = new TcpClient();
                tcpclient.Connect("", 23);
                NetworkStream ns = tcpclient.GetStream();
                byte[] inStream = new byte[10025];
                ns.Read(inStream, 0, (int)tcpclient.ReceiveBufferSize);
                string returndata = System.Text.Encoding.ASCII.GetString(inStream);
                Console.WriteLine("Data from Server : " + returndata);
                //string password = "admin";
                byte[] msg = Encoding.ASCII.GetBytes("admin");
                ns.Write(msg, 0, msg.Length);
I need your helps,,,Thank You Friends
Posted 2-Oct-11 0:20am
Bala Selvanayagam at 2-Oct-11 6:13am
carlos pin at 2-Oct-11 8:07am
Thank you Bala Selvanayagam for your help, and this is exactelly what i want +

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can use special server commands, for example in IMAP and POP servers
we use userID userid and pass password
for logging in our mailboxes.
define some commands in your server and send those commands from client side with parameters.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Advertise | Privacy | Mobile
Web03 | 2.8.150301.1 | Last Updated 4 Oct 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100