require 'socket' mtu = 1500 # standard ethernet s_sock = TCPServer.new('0.0.0.0',12345) s_conn = s_sock.accept response = "x" * (mtu - 40 - 12 - 10) # IP/TCP hdr, timestamp, gap response << "123456789\r" # fill the gap s_conn << response sleep 1 s_conn << "\nxxxxxxxxxDONE\r\n" s_conn.close