Problem with sending realtime data

Post here your questions about the Objective-C API for SFS2X

Moderators: Lapo, Bax

halfsoft
Posts: 2
Joined: 11 Jul 2012, 16:20

Problem with sending realtime data

Postby halfsoft » 11 Jul 2012, 16:25

I am developing an voice chat application that is sending chunks of 1019 bytes using ObjectMessageRequests every 60milliseconds.
It starts ok however in less than 20 seconds (sometimes more, sometimes less) the iOS client gets disconnected and the server prints an error message like this:

Server(Version: 2.0.1 and 2.1.0):
18:14:26,996 WARN [SocketReader] binary.BinaryIoHandler -
18:14:28,381 WARN [SocketReader] protocol.SFSProtocolCodec - Error deserializing request: java.lang.IllegalStateException: Invalid SFSDataType. Expected: 18, found: -58
18:14:28,381 WARN [SocketReader] binary.BinaryIoHandler - Illegal request size: -19193650 bytes, from: ( User Name: 438f8408563f362a33e9ef711308d3fa7ea8a144, Id: 0, Priv: 0, Sess: 192.168.1.30:54754 )
18:14:31,061 WARN [SocketReader] binary.BinaryIoHandler - unknown compression method
18:14:34,025 WARN [SocketReader] protocol.SFSProtocolCodec - Error deserializing request: java.lang.IllegalStateException: Invalid SFSDataType. Expected: 18, found: -90
18:14:34,029 INFO [SocketReader] sessions.DefaultSessionManager - Session removed: { Id: 1, Type: DEFAULT, Logged: Yes, IP: 192.168.1.30:54754 }
18:14:34,030 INFO [SocketReader] entities.SFSZone - User: 438f8408563f362a33e9ef711308d3fa7ea8a144 was disconnected.
18:14:34,031 INFO [SocketReader] api.SFSApi - User disconnected: ( User Name: 438f8408563f362a33e9ef711308d3fa7ea8a144, Id: 0, Priv: 0, Sess: 192.168.1.30:54754 )
18:14:34,032 WARN [SocketReader] binary.BinaryIoHandler - Incoming request size too large: 1387237932, Current limit: 8000000, From: ( User Name: 438f8408563f362a33e9ef711308d3fa7ea8a144, Id: 0, Priv: 0, Sess: 192.168.1.30:54754 )


iOS client(Version: 1.0.7):
2012-07-11 18:14:35.037 MicInput[7014:707] [SFS - WARN]Exception onDataRead!!!
[SFS - WARN]Not connected: can't send any request: <ObjectMessageRequest: 0x1bbd80>


Both the client and the server are in the same network.
User avatar
A51Integrated
Posts: 240
Joined: 03 Jan 2012, 19:55
Location: Toronto, Canada
Contact:

Re: Problem with sending realtime data

Postby A51Integrated » 12 Jul 2012, 16:57

I'm not sure the client can handle that amount of data through TCP. Object messages are sent through TCP and TCP is going to confirm receipt of the full packet. Therefore if a packet gets dropped, it will attempt it again. With this type of mechanism, you're going to run into issues with an iOS devide since the bandwidth capabilities and processing of the messages is somewhat limited (as compared to a desktop client with a 10/100/1000 ethernet card).

So most likely what's happening is that the client starts ok, but stumbles on a dropped packet (simply a capacity issue) and tries to catch up - but at that point, it's too late and messages are starting to back up because you're sending them every 60 milliseconds.

An alternate route is to try UDP. Create a generic Extension handler to handle the message and distribute the results back to ONLY the appropriate people (ObjectMessage gets sent to everyone in the room, not sure if you need that or not). That was you can send the messages in UDP as apposed to TCP and forgo TCP's packet verification which is a much faster and lighter way to go.
A51 Integrated
http://a51integrated.com / +1 416-703-2300
halfsoft
Posts: 2
Joined: 11 Jul 2012, 16:20

Re: Problem with sending realtime data

Postby halfsoft » 12 Jul 2012, 17:06

Thanks for the suggestion, I may try it eventually but today I created my own UDP server and client which I am using it to manage the data transmission for this project.
User avatar
A51Integrated
Posts: 240
Joined: 03 Jan 2012, 19:55
Location: Toronto, Canada
Contact:

Re: Problem with sending realtime data

Postby A51Integrated » 12 Jul 2012, 17:10

Without knowing the details of the project, it's hard to say, but you may want to look into the RedBox extension for Red5. That way, you can have live streaming audio and all the gaming and management features of SFS combined.
A51 Integrated

http://a51integrated.com / +1 416-703-2300

Return to “SFS2X iPhone / iPad / OSX API”

Who is online

Users browsing this forum: No registered users and 44 guests