Click here to Skip to main content
12,998,363 members (58,199 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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 1-Oct-11 23:20pm
Bala Selvanayagam 2-Oct-11 6:13am
carlos pin 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170622.1 | Last Updated 4 Oct 2011
Copyright © CodeProject, 1999-2017
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