Page 3 of 4

Re: Wrappers to do full sendNetworkData and ReceiveNetworkData

Posted: Mon May 05, 2025 4:52 am
by idle
This should do it on linux. Need to get it from libc

Code: Select all

ImportC "-lc"
__errno_location() 
EndImport   
error = PeekI(__errno_location()) 

Re: Wrappers to do full sendNetworkData and ReceiveNetworkData

Posted: Mon May 05, 2025 5:26 am
by Quin
Hi Idle,
You're correct, this seems to work, for the asm backend.
But, the constants don't exist in either case :mrgreen:
Is it safe for me to just comment out the couple lines it complains about, or should I actually map the constants?

Re: Wrappers to do full sendNetworkData and ReceiveNetworkData

Posted: Mon May 05, 2025 5:32 am
by idle
I updated the code in 1st post. it maps the linux errors to the #wsa constants but linux doesn't have
#WSA_IO_INCOMPLETE or #WSA_IO_PENDING equivalent so they are in the global scope

Re: Wrappers to do full sendNetworkData and ReceiveNetworkData

Posted: Mon May 05, 2025 6:33 am
by Quin
Thanks Idle, you're amazing! It's my bedtime, nearly 1 AM over here, but I'll try this tomorrow and let you know how it goes. :)

Re: Wrappers to do full sendNetworkData and ReceiveNetworkData

Posted: Mon May 05, 2025 6:41 am
by Quin
What's that they say about blind people?

We have great sleep schedules?

Wait no...definitely not that...


Instead of sleeping, I tested this, and it works, both with the ASM and C backends on Debian 12!
Thanks, Idle!

Re: Wrappers to do full sendNetworkData and ReceiveNetworkData

Posted: Mon May 05, 2025 6:57 am
by Quin
Wow, a tripple post...think that's a record for me. Sorry Fred!
I notice that when I run both the client and server on localhost, I can send packets of large length with no problem.
However, if I put the server on a remote server (a Linode) and run the client on my local machine, the maximum packet length is around 2750 bytes?
Any ideas?

Re: Wrappers to do full sendNetworkData and ReceiveNetworkData

Posted: Mon May 05, 2025 8:00 am
by idle
Isn't that like standard MTU maximum transmission unit on a lan? Seems to ring a bell

Re: Wrappers to do full sendNetworkData and ReceiveNetworkData

Posted: Mon May 05, 2025 3:45 pm
by Quin
idle wrote: Mon May 05, 2025 8:00 am Isn't that like standard MTU maximum transmission unit on a lan? Seems to ring a bell
Sorry, no bell being rung here.
Are you trying to tell me that I literally just cannot send packets of greter than 2750 bytes on anything that's not my LAN? Frankly I don't believe that.

Re: Wrappers to do full sendNetworkData and ReceiveNetworkData

Posted: Mon May 05, 2025 3:57 pm
by miso
It also depends on your internet connection type. ISP's also set MTU for their network, a PPOE protocol's default is just 1492. (ISP supporting RFC 4638 protocol can circumvent this.)

Re: Wrappers to do full sendNetworkData and ReceiveNetworkData

Posted: Mon May 05, 2025 4:09 pm
by Quin
Sorry, but what?
Why should my ISP be able to limit my packet size to 1492 bytes, when I can go into a web browser, load up google.com, and get served hundreds of megabytes of javascript and CSS? That's just a TCP socket too, no?

Re: Wrappers to do full sendNetworkData and ReceiveNetworkData

Posted: Mon May 05, 2025 4:15 pm
by miso
They stream it, and assemble together at the endpoint. And yes, ISP-s sets an MTU of their own.

Re: Wrappers to do full sendNetworkData and ReceiveNetworkData

Posted: Mon May 05, 2025 4:47 pm
by Quin
miso wrote: Mon May 05, 2025 4:15 pm They stream it, and assemble together at the endpoint. And yes, ISP-s sets an MTU of their own.
With all do respect to Idle, what are the point of these functions then? I expected to be able to send 10K+ chars over the wire exactly like I can over localhost. However, this seemingly only changed it from being able to send up to 700 or so bytes (a single read/write on the socket) to 2750 ,because of...some ISP limit? WTF? I hate networking.

Re: Wrappers to do full sendNetworkData and ReceiveNetworkData

Posted: Mon May 05, 2025 6:14 pm
by miso
I don't know, how screen readers work, if they work on a command prompt. In windows, if you open CMD, and type

Code: Select all

netsh interface ipv4 show subinterfaces
it will display your computers own MTU values. The loopback pseudo interface 1 with the big number is the mtu value when you send data local to local.
The small ones will be the externals.

Re: Wrappers to do full sendNetworkData and ReceiveNetworkData

Posted: Mon May 05, 2025 6:30 pm
by Quin
Oh my goodness, yeah, that is quite small. Around 1500 bytes.
This is unacceptable for my application. I'm building a realtime, peer-to-peer chat app, and users being limited to whatever their MTU vallue is for a packet length is super far from ideal.
Any suggestions?

Re: Wrappers to do full sendNetworkData and ReceiveNetworkData

Posted: Mon May 05, 2025 6:36 pm
by miso
My knowledge is is limited, and I only work with UDP. I divide my big data and number them in their assembly order. I send them all one by one and assemble when all arrived. You can send big data that way. I use a header that is part of the packet. (TCP might circumvent this on its layer, I can't give reliable advice for that because my lack of knowledge with TCP)