X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/6f34e365eed04c1b4ebcf6d90511dd9e4400880a..fe50e8140a2dbb3ba357a0ab777f34e07d568c23:/telnet.c diff --git a/telnet.c b/telnet.c index 5e6ba3c2..7b6c0bf6 100644 --- a/telnet.c +++ b/telnet.c @@ -1,7 +1,13 @@ #include #include #include +#ifndef AUTO_WINSOCK +#ifdef WINSOCK_TWO +#include +#else #include +#endif +#endif #include "putty.h" @@ -165,6 +171,11 @@ static void s_write (void *buf, int len) { try_write(); } +static void c_write1(int c) { + char cc = (char)c; + from_backend(0, &cc, 1); +} + static void log_option (char *sender, int cmd, int option) { char buf[50]; sprintf(buf, "%s:\t%s %s", sender, @@ -625,8 +636,11 @@ static int telnet_msg (WPARAM wParam, LPARAM lParam) { case FD_CLOSE: { int clear_of_oob = 1; - if (ioctlsocket (s, SIOCATMARK, &clear_of_oob) < 0 ) - return -20000-WSAGetLastError(); + + /* Don't check for error return; some shims don't support + * this ioctl. + */ + ioctlsocket (s, SIOCATMARK, &clear_of_oob); in_synch = !clear_of_oob; @@ -741,6 +755,12 @@ static void telnet_special (Telnet_Special code) { send_opt (o_echo.nsend, o_echo.option); } break; + case TS_PING: + if (o_they_sga.state == ACTIVE) { + b[1] = NOP; + s_write (b, 2); + } + break; } } @@ -755,5 +775,6 @@ Backend telnet_backend = { telnet_size, telnet_special, telnet_socket, - telnet_sendok + telnet_sendok, + 23 };