diff --git a/client/ip65/tcp.s b/client/ip65/tcp.s index 49d8b71..02fcd4c 100644 --- a/client/ip65/tcp.s +++ b/client/ip65/tcp.s @@ -26,6 +26,7 @@ MAX_TCP_PACKETS_SENT=8 ;timeout after sending 8 messages will be about 7 sec .export tcp_send_string .export tcp_close .export tcp_listen +.export tcp_send_keep_alive .export tcp_inbound_data_ptr .export tcp_inbound_data_length @@ -1013,7 +1014,9 @@ tcp_process: @not_syn: rts + @send_ack: + ;create an ACK packet lda #tcp_flag_ACK @@ -1041,6 +1044,12 @@ tcp_process: jmp tcp_send_packet +;send an empty ACK packet on the current connection +;inputs: +; none +;outputs: +; carry flag is set if an error occured, clear otherwise +tcp_send_keep_alive=@send_ack ;-- LICENSE FOR tcp.s -- ; The contents of this file are subject to the Mozilla Public License diff --git a/client/ip65/telnet.s b/client/ip65/telnet.s index 7d9de7c..c463afa 100644 --- a/client/ip65/telnet.s +++ b/client/ip65/telnet.s @@ -26,7 +26,8 @@ .import vt100_init_terminal .import vt100_process_inbound_char .import vt100_transform_outbound_char - + .import tcp_send_keep_alive + .import timer_read .import ip65_process .import get_key_if_available @@ -136,8 +137,19 @@ telnet_connect: jmp @send_char @not_line_mode: - + +@inner_loop: + jsr timer_read + txa + adc #$20 ;32 x 1/4 = ~ 8seconds + sta telnet_timeout @wait_for_keypress: + jsr timer_read + cpx telnet_timeout + bne @no_timeout + jsr tcp_send_keep_alive + jmp @inner_loop +@no_timeout: jsr ip65_process lda iac_response_buffer_length beq @no_iac_response @@ -156,7 +168,7 @@ telnet_connect: cmp #KEYCODE_F1 bne @not_telnet_menu jsr telnet_menu - jmp @wait_for_keypress + jmp @inner_loop @not_telnet_menu: tax @@ -503,7 +515,7 @@ naws_response_length=*-naws_response .segment "APP_SCRATCH" telnet_ip: .res 4 ;ip address of remote server telnet_port: .res 2 ;port number to connect to - +telnet_timeout: .res 1 connection_closed: .res 1 telnet_use_native_charset: .res 1 ; 0 means all data is translated to/from NVT ASCII buffer_offset: .res 1