Faster TCPSockets

there HAS to be something else going on that we cant see

I cant get several Mb/sec with sockets
The DB driver I wrote relies on sockets all event driven and they worked for a publishing system which moved tons of data through them
Were they as fast as the ones written in C++ ? No but thye were a damn sigh easier to deal with as various OS updates came along

1 Like

Same I have done a ton with Xojo Sockets and I never had show stopping socket performance issues. MBS was a bit faster since they wrap Lib2SSH client. Can you post your code @Meestor_X?

CURLSMBS and RAWSocketMBS both would do TCP/IP sockets and you can do the protocol on top.

If you need HTTP(S) or FTP(S) or SFTP, you can use CURLSMBS directly.

1 Like

I did earlier in the thread. I first tried it with the normal DataAvailable events, then, just to see, tried it with a synchronous loop.
There’s nothing to it. Read input, write to output. Lather, rinse, repeat.
Super-slow on Xojo, instantaneous on .NET.

1 Like

Could this be a socket configuration issue (size of buffers etc…)?
Maybe Xojo is initialising the sockets with different defaults to the .NET sockets.
From what I can remember, the MBS plugins have functions that allow some configuration of the Xojo sockets so it might be worthwhile experimenting with those.

The Xojo SSL Sockets used to process stuff in 8K chunks, so we wrote our own to work around.
But that one was fixed for 2019r1. 32344

Have you tried disabling nagle’s algorithm in xojo or performing a .Flush after your .Write’s ?

:scream: but why are you using DoEvents en a Xojo app???

Just kidding. I can agree that even if xojo is not as fast as other tools, usually is not this bad.

What Xojo version are you using?
Could you make test using other Xojo sockets? TCPSocket vs Xojo.Net.TCPSocket.
Can you test on another PC?

You said that your communication is TCP, it is HTTP?

I had already tried the .Flush (due to a bug in MacOS where the Socket will stop sending after a while if the GUI is not updated), it made no difference.

I have tried reducing the size of the packets, which are each less than 1kb anyway. No change. (No such manipulation necessary on .NET)

2019r1.1
Will Xojo.Net.TCPSocket work on desktop?
I tested on a Windows PC. Same speed.

If you remove the hardware reads/writes does it speed up significantly i.e. is the slow down to/from the editor and/or to/from the hardware?
Have you wireshark’d things to see where the delay is?

Not sure how I’d do that, but even if I did, what would it matter? The slowdown is somewhere in Xojo, proven by the .NET version being 10x faster.

Gonna try and connect with @npalardy to see if we can figure this out.

Xojo.Net.TCPSockets is weird on 2019r1.1. Seems like it’s “kinda” there…

The LR shows it as available, the autocomplete shows it as available, with all its properties and methods, but it’s not there as a Super and I get all kinds of errors trying to add them to the project.

Can’t add it as an object and then change the super, as the LR indicates. Like I say, it’s very weird the way it “sort of” exists…

It’s just another step in the process of narrowing down the variables to try and figure out the cause, e.g. is it a xojo<>hardware issue or a xojo<>xojo issue.

I still think using Socket.Poll in lieu of DoEvents would be a useful experiment.

Fair enough. I do appreciate all the suggestions! Norm and I are scratching our heads on this one!

I’m going to see if I can figure out an MBS socket. Stuck at the moment on how to make one “Listen”… MBS is VERY different from a TCPSocket so I’m not having much luck plugging one in in place of the other…

I’ll keep plugging at it.

If there’s any MBS experts here, maybe someone can help me figure out how to do the equivalent of:

myTCPSocket.Port = 50000
myTCPSocket.Listen

RawSocketMBS doesn’t have a connected event, or an .IsConnected property, so how do I know when the Socket has connected?

II can confirm that even after screen sharing the apps are dead simple and using either the event driven async or fully synchronous set ups they are dog slow and I’ll be damned if I can see why

The synchronous one did get swapped to use Socket.Poll instead of doevents since DoEvents in GUI’s can have weird side effects (it starts yet another instance of the event lop basically and that can be horrible)

But even the switch to using the events didnt suddenly make issues go away nor a ton faster

1 Like

Ok, through trial and error I finally figured out how RawSocketMBS work, and the additional steps needed to create a listener.

Initial testing shows it completes the sync in 1:43, so it’s only 3x slower than Direct connection or via .NET, but that’s a heck of a lot faster than the Xojo TCPSockets!

Perhaps with some tweaking of parameters I can speed that up?

Anyone know how to tell what parameters I should try adjusting on the RawSocketMBS?

1 Like

BufferSizes make no difference.

How do you disable the Nagle Algorithm in Xojo tcp sockets @anon72844311?