Telnet Server

I would like to implement a telnet server in C. How can I continue this? Which RFC should I look at? This is important to me and I would appreciate any help.

+5
source share
6 answers

For a very simple telnet (only telnet for the port and echo bytes) there are not many. Read from the socket, process it (on the echo server, do nothing), return the result. You can implement a simple MUD-style server without knowing anything in any RFC.

But if you are really worried about RFCs, RFC 854 might be the starting point.

http://www.faqs.org/rfcs/rfc854.html

+9
source

, " UNIX Network Programming Vol 1" - RFC .

, eBay . , , .

+4

, telnet - , stdin stdout .

, "", , $TERM, / ( , ).

telnet, TCP-, RFC 854 - . RFC, , http://en.wikipedia.org/wiki/Telnet

+4

..

checkout beej guide: http://beej.us/guide/bgnet/

+3

, API- , , .

, , GLib GNet.

, GNet 4000, . , .

#include <glib.h>
#include <gnet.h>

void client_connect(GServer G_GNUC_UNUSED *server, GConn *conn, gpointer G_GNUC_UNUSED user_data){
  g_print("Connection from %s\n", conn->hostname);
  gnet_conn_disconnect(conn);
  gnet_conn_unref(conn); conn = NULL;
}

int main(void){
  GMainLoop *loop = g_main_loop_new(NULL, FALSE);
  GServer *server;
  gnet_init();
  server = gnet_server_new(NULL, 4000, client_connect, NULL);
  g_main_loop_run(loop);
  g_main_loop_unref(loop); loop = NULL;
  return 0;
}
-1

I recommend installing Wireshark to view Telnet traffic using an existing Telnet server. Then, by looking at the log, you can better understand how the server interacts with the client. Then use the RFC as a reference if you do not understand any of the commands passing through the wire.

-1
source

All Articles