Data Not Sent (Sometimes)

Post here your questions about the Java client / Android API for SFS2X

Moderators: Lapo, Bax

cleareyestudios
Posts: 3
Joined: 07 Feb 2012, 03:32

Data Not Sent (Sometimes)

Postby cleareyestudios » 02 Mar 2012, 01:08

I have an odd problem. I am doing a downloadable content type of concept. I select the content that I want to download, this sends a request to the server, the sever will get the files and send it back to the client. Fairly straightforward. The problem we're experiencing is that the server will send the first 2 files and then stops. As soon a I log into admin console all of the remaining files get send over. Without being logged into the admin console only 2 files ever get sent to me (our of about 20).

The server code is something like this

for (File sound : sounds)
{
resObj.putSFSObject("MY_FILE",bytes)
send(CustomExtension.FILES resObj, user);
}


Any ideas, or any direction would be much appreciated
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Data Not Sent (Sometimes)

Postby Lapo » 02 Mar 2012, 09:41

Sending data in a for loop is not a good idea.
It will fill the user queue very quickly possibly triggering the dropping of packets.

How many files are you sending? What size are they?
Take in consideration that SFS2X is not an FTP server and it's optimized for small messages/packets. If you plan to deliver large binary files for thousands of users you might deteriorate the overall server performance.
In this case it would be better to load external assets via regular HTTP calls to your web-server (or the internal SFS2X http server, which is there exactly for that purpose ;) )
Lapo
--
gotoAndPlay()
...addicted to flash games
cleareyestudios
Posts: 3
Joined: 07 Feb 2012, 03:32

Re: Data Not Sent (Sometimes)

Postby cleareyestudios » 02 Mar 2012, 13:36

Hi Lapo,

Thank you for the quick response! The files are being send in three sets (images,fonts,sounds) and no set will have more than aprox. 15 files). Most likely the max number of files send will be 30 (although even that might be stretching it). The files on average are 10KB and no file should exceed 1MB. As you can see the amount of data being sent is fairly small and performance is not at all critical for this call.

I could send them in 3 calls instead of sending all the files one by one.

Based on the above would you still recommend moving away from the socket server and using a web server for this?

Thanks in advance,

cleareyestudios
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Data Not Sent (Sometimes)

Postby Lapo » 02 Mar 2012, 16:27

Yes, very much indeed. This is a job for a regular HTTP server.
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Java / Android API”

Who is online

Users browsing this forum: No registered users and 36 guests