telnet sessions nows send a 'keepalive' (empty tcp packet) every 8 seconds or so, since my broadband router seems to timeout NAT entries after 10 seconds of inactivity (!)

git-svn-id: http://svn.code.sf.net/p/netboot65/code@225 93682198-c243-4bdb-bd91-e943c89aac3b
This commit is contained in:
jonnosan 2009-12-06 10:32:49 +00:00
parent 28de61b6e0
commit 0fdf2be2b8
2 changed files with 25 additions and 4 deletions

View File

@ -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

View File

@ -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