0

Recently, I'm learning Supersocket. I made telnet Supersocket with this example.

When I try to access with telnet, server returnes Operation is not supported on this platform.

Below is error messages.

Press and key to start the server!
d

The server started successfully, press key 'q' to stop it!
Unhandled exception. System.PlatformNotSupportedException: Operation is not supported on this platform.
   at SuperSocket.SocketBase.SessionHandler`1.BeginInvoke(TAppSession session, AsyncCallback callback, Object object)
   at SuperSocket.SocketBase.AppServerBase`2.OnNewSessionConnected(TAppSession session)
   at SuperSocket.SocketBase.AppServerBase`2.SuperSocket.SocketBase.IAppServer.RegisterSession(IAppSession session)
   at SuperSocket.SocketEngine.AsyncSocketServer.RegisterSession(IAppSession appSession)
   at SuperSocket.SocketEngine.AsyncSocketServer.ProcessNewClient(Socket client, SslProtocols security)
   at SuperSocket.SocketEngine.AsyncSocketServer.OnNewClientAccepted(ISocketListener listener, Socket client, Object state)
   at SuperSocket.SocketEngine.SocketListenerBase.OnNewClientAccepted(Socket socket, Object state)
   at SuperSocket.SocketEngine.TcpAsyncSocketListener.ProcessAccept(SocketAsyncEventArgs e)
   at SuperSocket.SocketEngine.TcpAsyncSocketListener.acceptEventArg_Completed(Object sender, SocketAsyncEventArgs e)
   at System.Net.Sockets.SocketAsyncEventArgs.OnCompleted(SocketAsyncEventArgs e)
   at System.Net.Sockets.SocketAsyncEventArgs.OnCompletedInternal()
   at System.Net.Sockets.SocketAsyncEventArgs.ExecutionCallback(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Net.Sockets.SocketAsyncEventArgs.<>c.<.cctor>b__179_0(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
   at System.Threading.ThreadPoolBoundHandleOverlapped.CompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
   at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pNativeOverlapped)

Server.cs

using SuperSocket.SocketBase;

Console.WriteLine("Press and key to start the server!");

Console.ReadKey();
Console.WriteLine();
var appServer = new AppServer();

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

if (!appServer.Setup(2023))
{
    Console.WriteLine("Failed to setup!");
    Console.ReadKey();
    return;
}

Console.WriteLine();

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();

What's wrong with my code? I activated window function of telnet client.

sangeun jo
  • 37
  • 9
  • Please [don't post images of text](https://meta.stackoverflow.com/questions/285551/why-should-i-not-upload-images-of-code-data-errors). *All* text needs to be copy-pasted as text into your questions. – Some programmer dude Aug 11 '23 at 11:59
  • `PlatformNotSupportedException` is often thrown by old libraries used in project targeting new framework, which api doesn't provide required methods. You can try to lower target framework of your project until it matches. Try .Net Framework 4.7 ? – Sinatr Aug 11 '23 at 12:13
  • @Sinatr No, I created core project. I recreated project as .net framework, it worked. Thank you. – sangeun jo Aug 16 '23 at 05:17

0 Answers0