Super Socket Telnet Example Issue

Feb 20, 2014 at 4:04 AM
Hi,

I went through the tutorial and documentation given in the below link

SUPER SOCKET TELNET EXAMPLE

Server is getting started successfully,

but when I open my Telnet Client

and writing: "telnet localhost 2012" "ENTER" {used different combinations as well :) }

but telnet says Invalid command...

Its my first time, so Kindly excuse me if my issues is silly enough but it took a shit out of me :).

Here is my code and screen shotImage

Code
using SuperSocket.SocketBase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SuperSocket_Test
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Press any key to start the server!");

            Console.ReadKey();
            Console.WriteLine();

            

            var appServer = new AppServer();
            //Setup the appServer
            if (!appServer.Setup(2012)) //Setup with listening port
            {
                Console.WriteLine("Failed to setup!");
                Console.ReadKey();
                return;
            }

            Console.WriteLine();

            //Try to start the appServer
            if (!appServer.Start())
            {
                Console.WriteLine("Failed to start!");
                Console.ReadKey();
                return;
            }
            appServer.NewSessionConnected += new SessionHandler<AppSession>(appServer_NewSessionConnected);
            Console.WriteLine("The server started successfully, press key 'q' to stop it!");
            
            while (Console.ReadKey().KeyChar != 'q')
            {
                Console.WriteLine();
                continue;
            }

            //Stop the appServer
            appServer.Stop();

            Console.WriteLine("The server was stopped!");
            Console.ReadKey();
        }
            
        static void appServer_NewSessionConnected(AppSession session)
        {
            session.Send("Welcome to SuperSocket Telnet Server");
        }
    }
}
Thanks,
Feb 20, 2014 at 4:07 AM
Coordinator
Feb 20, 2014 at 4:24 AM
You didn't handle the request. You should handle request received event or define your commands.

Please read the document and QuickStart in the source code:
http://docs.supersocket.net
Coordinator
Feb 20, 2014 at 4:26 AM
BTW, your telnet usage is completely wrong.

In the command line dialog, you can input "telnet ip port" to connect directly.
Feb 20, 2014 at 4:26 AM
Ok Thanks, Let me read the document first, will get back to you if I find an issue to get it resolved.

Thanks,
Feb 20, 2014 at 4:27 AM
Yes I tried to put port as well but In the example I have not defined any port, is 2012 is the port?
Feb 20, 2014 at 4:29 AM
Sorry, I didn't understood

In the command line dialog, you can input "telnet ip port" to connect directly.

are you talking about the console supersocket application? command line?
Coordinator
Feb 20, 2014 at 4:38 AM
Open a new command prompt, enter "telnet [ip] [port]", and then click 'Enter' button.
Marked as answer by erarijit on 2/19/2014 at 9:42 PM
Feb 20, 2014 at 4:45 AM
Thanks A lot it worked in new command prompt when i write " telnet myip port ".

but in the documentation it says:

Handle the Incomming Connection
Register new session connected event handler

appServer.NewSessionConnected += new SessionHandler<AppSession>(appServer_NewSessionConnected);
Send a welcome message to client in the handler

static void appServer_NewSessionConnected(AppSession session)
{
session.Send("Welcome to SuperSocket Telnet Server");
}

Test by telnet client
  1. open a telnet client
  2. type "telnet localhost 2012" ending with an "ENTER"
  3. you will get the message "Welcome to SuperSocket Telnet Server".
If you can just tell me how and what just happened.

Thanks,
Feb 20, 2014 at 5:20 AM
I got that working by

When my Telnet Client opens:

I need to change my port number (by default its 23)

we need to write

o localhost portnumber or

o myipaddress portnumber