sende faster than receiver

so I made a basic winsock application that sends/receives files from lan computers and it works perfectly on my computer but when I try to send files to my friend's pc, I notice a huge speed difference between my sending and his receiving I am using TCP protocol and FD_READ window message to recv incoming messages, I have set the buffer size to 262144 bytes (256 kb) and my socket are set on blocking mode I guess, how could this happen

Update: I think that the problem is coming from the fact I'm using WSAAsyncSelect() witch sets recv() automatically to non-blocking I tried WSAEventSelect(sock, NULL, 0) but It didn't work, I just want to keep the FD_READ window message because otherwise I wou't be able to handle other window messages when recv() is preventing that from happening
Last edited on
Exactly HOW are you sending files to your friend's PC? Direct connect by a cable? Internet?

A LAN isn't the internet, lag can be quite the issue that would go unnoticed when dealing with low packet numbers of most web pages.
no definitely not lag issue, It's a LAN network and internet access is not needed, the problem is that recv() is non blocking and gets called frequently and that causes ugly buffers, sometimes my sending progessbar is at 75% while my friend is still at 10%, I just want to know how to set the socket back to blocking mode while still using the event FD_READ
So.....slower transfer is not lag?

Cabling and network connection cards can be a major PITA for creating unexpected lag.
whatever you say,
please help me find a solution to my problem, witch I told you about above.
Last edited on
whatever you say,

So you really don't want help, I see.

In my decades of working with networks hardware can be just as much a source of lag as software.

Whatever, back at ya.

Go ahead and report me. That would make me and others less willing to help you.
Last edited on
Ok so I hope your mom dies a slow painful death, and that your dad left you as kid, and that you will fuck your own sister and then suicide. enjoy, you gotta find something useful to do with your gay ass life dog, fucking retard.
Last edited on
Nice way to beg for help, loser.
To be fair, I don't think fewdiefie said anything that was unreasonable up until the last post.
But also, I don't think the issue is being described well enough, I think more code and solid performance comparisons are needed (w/ minimal reproducible example), and speeds need to be compared to using an existing solution like using Python's built-in server. Lots of diagnostic stuff could help narrow down the issue.
Last edited on
thank you @Ganado

my code is something like this
case FD_READ:
    int sz = recv( g_socket, buff, 262144, 0 );
    if( sz <= 0 )
        if( WSAGetLastError() == WSAEWOULDBLOCK )
        if( g_bClient )
            r = send( g_socket, g_fileBuff + index * 262144, chunkSize );
            g_nBytes += r;
        else if( g_bHost )
            memcpy( g_fileBuff, buff + index * 262144, sz );
            g_nBytes += sz;

Nice way to beg for help, loser.   // loser says 

@Furry Guy, why you changed your goddamn comment you Sociophobic son of a gay, I will fucking cut your ears off and put them inside of your mom, toxic dog, I bet you're fucking virgin that's why you spend your whole life in here sickfuck, keep reporting me now like I care, you report me I fuck your sister, fair enough. I don't want your fucking gay help give it your dad though, you don't know shit about networking idiot, you spent decades wasting your miserable life really go suicide.
Last edited on

Keep showing your true colors, troll.

[edited to add:]

If you'd just shut the fuck up, stop making online tough guy empty threats, I'd stop laughing at you and your pitiful whiny antics.
Last edited on
Troll? go troll your fucking mom's pussy
Keep showing your true colors dawg what the fuck are you talking about
I will not shut the fuck up, I will eat your mom's pussy till she release her "true colors"
and then I will cut her boobs and feed them my dogs, and guess what, you will be watching the whole thing, and you will have a boner on your mom, the last thing she's gonna see is your half inch dirty penis getting hard for her ugly face, then I will cut that freak and make you sit on it, you will love it and beg for more, but I will slap you hard in the face and fuck you with a 2 feet stick, fucking gay you still love it, nothing I can do to that ass will make her suffer, Oh I found it, I will cut your big ass and feed it to my dogs who just ate your mommies boobies LOSER! guess who's next btw you reported me 5 times so imma fuck ur mom 5 times

[edited to add:]
gay loser go die
Last edited on
This is hilarious !
You might look into your recv() logic: If recv() returns zero, that means the other side has shut down: You should handle this accordingly.
Topic archived. No new replies allowed.