Jump to content

[SOLVED] flush socket or something similar


Recommended Posts

i am currently just making this app that you telnet into and it prints lines to the screen

i need it to print lots of lines very quickly at the moment i have it write a line one character at a time then i write a "\r\n" and usleep for 125000 or .125 seconds

then sometimes it will send the line and other times it sends 2 lines at the same time so the client gets a gap with no input and sometimes it waits and sends 3 lines at the same time

what i want to do is somehow flush the socket or write enough bits so it will send the data but the filler bits must be ignored at the client.

is this even remotely possible.

i have been looking around and i can't find anything.

if it matters the size of one complete line it 52 bytes.

but normally comes as a 104 or 156 byte packets.



Link to comment
Share on other sites

well i did a lot of research and found out about MTU (Maximum transmission unit) for Ethernet it is 1500 bytes including TCP and IP headers

so i did more research and found out a TCP header is 20 bytes and same for a IP header

so i added a pad to 1460 bytes of \000 or null



Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.