Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Socket Wi-Fi Speed Considerations

Author
Message
xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 9th Feb 2013 02:21
Hi boys,

i wanna ask this question to you all...
After i developed my CB Radio Box using BSD Sockets i learned that the communication is really really slow on wi-fi devices, cause the same App on the Mac is really fast....

I do an example:
On Mac 30kb of audio (30sec, very high compression and low mono 8000Hz audio) go really fast and arrive to the destination trough my powerful server (client->server->clients) in 0.3s....
On wi-fi devices it take the same time you talk, so 30kb in 30sec, and i don't understand this.
If a user have a 25kb upload it must arive in 1,5s.....

If i look a video on youtube it load at 800Kb, so why my sockets go so slow???
In download and upload?

Is there a way to frame burst the connection on a wi-fi with BSD sockets?
I searched for it all over the net without results.

Someone have some tips or hints for this kind of communication?

Long life to Steve!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 9th Feb 2013 08:43
try the method of elimination
its only your app yes/no
its the signal strength yes/no
with and without the transfer encryption yes/no
what is the real upload/download limit (some Websites can do this with the help of a browser)
any short circuit loops in your app yes/no
is your connection permanent open port-port yes/no
did the server push the data in the output buffer more then the client need or request you each packet yes/no
interact server - client without pause yes/no
...
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 9th Feb 2013 08:49
There is no simple answer to this.

Much depends upon the wireless hardware. Is /g or /n? If it's /n you should get about 10 Megabytes/sec if the router is within about 20 metres of the receiver. But if there are lots of wireless sources in the area you may get better results by changing channels.

30kb in 30 seconds is ridiculously low. There is a problem with your hardware, and possibly the software for the sockets.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 9th Feb 2013 11:26
at LAN ~

IEEE 802.11g 20–25 Mbit/s
2500-3125 kB/s

IEEE 802.11n 100-200 Mbit/s
12500-25000 kB/s
xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 9th Feb 2013 13:23 Edited at: 9th Feb 2013 13:30
I will try to answer the good questions you proposed:

- its only your app yes/no
Well, i don't know. Cause some Apps don't make Client -> Server -> ClientS but only Peer to Peer between clients using a server to discover IP and PORT.
Sometimes go fast (never really fast) and sometimes go slow.

- its the signal strength yes/no
Yes is at max.

- with and without the transfer encryption yes/no
Hmmm, i use a personal coded encryption that is really light, so i don't think can be (maybe i'm wrong that on big files can be much, correct me if i'm wrong )

- what is the real upload/download limit (some Websites can do this with the help of a browser)
Well i can see the upload and download i use from other applications, but i don't know if they use a web server instead of a socket server (like mine). Do you think an Apache web server can be faster than the socket server?

- any short circuit loops in your app yes/no
The socket server is the first thing i developed since i started to code on AppGameKit, and i've changed it many times since today (2 years). I also have a 10 years of experience in multiplayer games, and i never had this kind of problems.
Anyway i use POLL from the devices cause i don't know how to use uPnP on Obj C.

- is your connection permanent open port-port yes/no
No, is not permanent... sometimes i see the first connection is fast, the second more slow, and so go on. To do read and write i use socket shutdown... You suggest other? Permanent?

- did the server push the data in the output buffer more then the client need or request you each packet yes/no
The bufffers are the same on server and client, and are very large (512000kb), as i do a service for each kind of app.

- interact server - client without pause yes/no
What do you mean?

Edit :
Some info...
I tested in the past to do a 1024kb / 2068kb buffer in a loop, but the result is the same.
I've also tuned the server for a best frame burst but is about the same.
I use TCP with stream / select and non blocking to manage multiple calls.
All ok, the server is really fast and responsive, the only thing is when a message is over 5k/10k that it start to go slower and slower.
Sometimes seems the Apple device has problem to go at max download/upload immediately.

Long life to Steve!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 9th Feb 2013 16:38
i can told you only my experience.
i would let the connection open as pipeline.
it should come a error event if the connection loss
and then you can try reopen it.
this connection have a in/out buffer (i mean not the packet buffer).
your server can push all new data in this buffer.
your server know who want listen to what.
your server can handle 65535 connections at once theoretical.
at connection i think the out buffer will transferd automatically
to the other side to the in buffer.
the client can read always this input buffer until it is empty.
the packed transfer buffer is very small ~1kB, i think you can't set
the out/in buffer too. you can push a whole mp3 at once in this
as quick as lightning and the server is ready and do nothing.
i think AppGameKit handle the data transfer at Sync, else some Examples
would make a endless loop.
i use windows TCP Api long ago for my own web/http server.
in your position i would try the wifi device with a w-lan router and your server app at home first.
xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 10th Feb 2013 09:35
Well, i got a doubt in those days....
Maybe on iOS we need to use the CFNetwork to get the best speed on the Wi-Fi and 3G, cause i read around that is suggested to don't use BSD Sockets on it.
Now i'm trying to code the CFStream to see if it is faster, and i will post the test result.

Long life to Steve!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 10th Feb 2013 10:29
I'm curious about it.
xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 11th Feb 2013 20:12
I'ts incredible....
I'm testing with the NSURLRequest and the speed is always slow...
I'm thinking that the wi-fi speed is very ridicolous on the devices or there is a sort of speed blocking.
Someone of the staff that worked on CFNetwork or NSURLrequest know something about this?

Long life to Steve!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 11th Feb 2013 20:43
did you connect with NSURLRequest to a web side or your server app ?
xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 12th Feb 2013 02:18 Edited at: 12th Feb 2013 02:19
Yes now i done an internal wrapper for my sockets on the Apache of the dedicated.
And surprise, the upload and download speed is the same as the sockets.
Now i know the server and client based on sockets are good coded, but i start to think there is something i don't know of the devices WI-FI.
The only thing i know now is that the Cellular line now work, cause NSURLRequest is on HTTP and is over the CFNetwork so, it auto enable the antenna.

Now on the device i don't have to manage the Signal Abort and the Wi-fi Antenna, so we need to discover what makes youtube app more fast than ours or another apple app on upload.

I done 3 way of test:
- NSURLRequest Sync
- NSURLRequest Async (via Thread)
- NSURLRequest Async (via delegate)

And all is the same.
What do you think?

Long life to Steve!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 12th Feb 2013 11:44
about NSURLRequest i asked because i want know you use any
website and use upload/download as test system for speed compare for your client app.

Quality of service can limit the transfer.
Or a special energy saver mode.
My old Sony PSP was slow until i get a new router with better firmware.

did you compare your client with a other iOS hardware/os version?
xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 12th Feb 2013 13:05
Well i test my apps on iPad 2, iPod 5, iPhone 3GS, Mac Mountain Lion
I have no other to test. But from the MAC with the LAN the speed is impressive, i can send also a big video record in some seconds.

In your opinion, can be a firewall or a router, also if in lan all goes ok?

Long life to Steve!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 12th Feb 2013 13:32
what are the results at iPad 2, iPod 5, iPhone 3GS
all have 30kb in 30sec with wifi???

are you in lan with your MAC with cable or wireless?

a firewall or a router slow down all a little bit but not
really noticeable.

my LAN at home:
tablet > wireless > router < cable < pc
xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 13th Feb 2013 05:36
Yes, the speed is the same, but on the 3GS is more slow.
They are in Wireless and the MAC is in LAN cable.

Now i'm testing an NSURLRequest using the Headers with a file (NSData) to see if we got an improvement insted to send it as long POST url data.

For the moment, no improvements.

Long life to Steve!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 13th Feb 2013 08:30
you mean all the same speed and all very slow,true?
what model is your mac?
how much mbit can the mac transfer in the second and how much with your
client app?
xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 13th Feb 2013 14:12
This morning i done the porting on the MAC of the app.
I tested it and on the MAC is always fast. 100kb in 1 sec.

But the devices are always slow.
Now i wanna try to send a mail to the Apple's engeneer (strange a TGC programmer didn't replay to this post to show his test).

I tested the "Speed Test" on the ipad and it reach the 8Mb/s
Now i think there is something to enable.
Hope TCG team answer to this post.

Long life to Steve!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 13th Feb 2013 16:04
100kb in 1 sec with mac and cable?
i think you don't make really a transfer test with your client-server app.
should have 12500kb with a old 100mbit network adapter.
this is 125x slower.
Sounds thats similar your wlan devices.
xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 13th Feb 2013 16:33
No in Italy they call 8,5 Mbyte the 850kb.... the real was 85Kb download and 0,9 up.
If i'm not wrong LOL....
In italy the connection is not good enough, but i download 1Mb in 1sec.
and upload 1Mb in 10 sec.

This is the medium Italian speed.
But my server is in Germany, on the main Node (it cost very much / month) and is on the 155Mbit full duplex on linux.

Anyway the Mac works great, the devices no.

Long life to Steve!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 13th Feb 2013 17:25
ahh, i thought you test the mac with client and a pc as server at home in lan (at first).
xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 18th Feb 2013 12:22
Maybe i understood the problem, i open a new thread to ask directly to the TGC team.

Long life to Steve!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 19th Feb 2013 16:47
today i made a host/client test app just for fun

i use my tablet as host (wlan) and the pc as client and i get ~900000 bytes per second with this example.

xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 19th Feb 2013 17:36
Yes but this is done with agk and basic.
The problem is on Apple devices with sockets BSD and NSURLRequest.


Long life to Steve!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 19th Feb 2013 18:24 Edited at: 19th Feb 2013 18:31
yes, i know, maybe its useful for a test.
did agk not use the same bsd sockets for a connect & transfer at the apple device?
the NSURLRequest looks more as a extended simplified function.
edit:
today i try to connect agk with a visual basic 6 winsock host/client app.
i get a connection and send something to the agk client
but i don't know how i can read the raw data?
xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 20th Feb 2013 09:59
Try to send a big amount of data.
Do a string of 1Mb and try to see in how many sec it arrive.

Long life to Steve!

Login to post a reply

Server time is: 2024-11-24 07:38:24
Your offset time is: 2024-11-24 07:38:24