Problem when sending byte array

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

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

Postby Lapo » 01 Feb 2011, 08:12

We have a new update addressing this issue here -> http://smartfoxserver.com/forums/viewtopic.php?t=9972
Lapo
--
gotoAndPlay()
...addicted to flash games
geraldyeo
Posts: 9
Joined: 09 Feb 2011, 11:40

Postby geraldyeo » 09 Feb 2011, 11:54

Hi, I'm still having issues after using the new release.

I'm trying to send over a byte array of an image from Flash over SFS to iOS to display.

I've tested it with a Flash client and it correctly renders the image. It crashes in iOS.

Code: Select all

[Session started at 2011-02-09 21:09:46 +0800.]
2011-02-09 21:09:51.926 SFSwebcam[12021:207] connection success
2011-02-09 21:09:51.943 SFSwebcam[12021:207] ROOM JOINED
2011-02-09 21:09:51.958 SFSwebcam[12021:207] *** Terminating app due to uncaught exception 'SFSCodecException', reason: 'Invalid SFSDataType. Expected: 18, found: 120'
*** Call stack at first throw:
(
   0   CoreFoundation                      0x01142be9 __exceptionPreprocess + 185
   1   libobjc.A.dylib                     0x012975c2 objc_exception_throw + 47
   2   SFSwebcam                           0x0000e1b7 -[DefaultSFSDataSerializer decodeSFSObject:] + 202
   3   SFSwebcam                           0x0001002e -[DefaultSFSDataSerializer binary2object:] + 222
   4   SFSwebcam                           0x00024832 +[SFSObject newFromBinaryData:] + 72
   5   SFSwebcam                           0x00026bdd -[SFSProtocolCodec onPacketRead:] + 50
   6   SFSwebcam                           0x000232f7 -[SFSIOHandler handlePacketData:] + 781
   7   SFSwebcam                           0x0002406b -[SFSIOHandler onDataRead:] + 558
   8   SFSwebcam                           0x0000668f -[BitSwarmClient stream:handleEvent:] + 1753
   9   CoreFoundation                      0x0111e1d2 _inputStreamCallbackFunc + 82
   10  CoreFoundation                      0x010f2093 _signalEventSync + 99
   11  CoreFoundation                      0x010f1ffe _cfstream_shared_signalEventSync + 334
   12  CoreFoundation                      0x0112401f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
   13  CoreFoundation                      0x0108228b __CFRunLoopDoSources0 + 571
   14  CoreFoundation                      0x01081786 __CFRunLoopRun + 470
   15  CoreFoundation                      0x01081240 CFRunLoopRunSpecific + 208
   16  CoreFoundation                      0x01081161 CFRunLoopRunInMode + 97
   17  GraphicsServices                    0x0178f268 GSEventRunModal + 217
   18  GraphicsServices                    0x0178f32d GSEventRun + 115
   19  UIKit                               0x0049642e UIApplicationMain + 1160
   20  SFSwebcam                           0x000028bc main + 102
   21  SFSwebcam                           0x0000284d start + 53
)
terminate called after throwing an instance of 'SFSCodecException'
User avatar
Lapo
Site Admin
Posts: 21009
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 09 Feb 2011, 14:53

can you send us that same test image, so that we can test?
post a link to it if it's not too big
Lapo

--

gotoAndPlay()

...addicted to flash games
geraldyeo
Posts: 9
Joined: 09 Feb 2011, 11:40

Postby geraldyeo » 10 Feb 2011, 03:45

Sure, here it is: http://dl.dropbox.com/u/276096/labs_savewebcam.zip

I've given the link to an experiment I was trying out: To send a series of images to the iPhone. This one is an initial test of sending bytearray between 2 flash instances.
User avatar
Lapo
Site Admin
Posts: 21009
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 12 Feb 2011, 10:43

Thanks, we'll check it out asap
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
cemuzunlar
Posts: 47
Joined: 26 Dec 2008, 00:45
Contact:

Postby cemuzunlar » 18 Feb 2011, 13:39

Hi geraldyeo,

We tested 100 K, 1 MB, 4 MB, 5 MB, 9 MB image files send from iPhone to Server, Server to iPhone, both with simulator and with device. We displayed the images send from the Server in he iPhone; Calculated the MD5 both on Server and on iPhone. No problem or crash happened during those tests.

Please make sure that

You are using the latest fixed API (http://smartfoxserver.com/2X/quickUpdat ... 010211.zip)
If it is the correct API, lines 82:85 should be:

Code: Select all

//handle Compression
if (_pendingPacket.header.compressed) {
    _pendingPacket.buffer =
           [NSMutableData dataWithData:[_pendingPacket.buffer zlibInflate]];
}


if you are the latest API but still having problems, please send me the:

1) Your server source code
2) Your iPhone XCode project
3) Used test files etc.
4) Your SFS2X version.

Thanks,
Cem Uzunlar
Infosfer Game and Visualization Technologies
http://www.infosfer.com
contact@infosfer.com
geraldyeo
Posts: 9
Joined: 09 Feb 2011, 11:40

Postby geraldyeo » 21 Feb 2011, 08:10

Hi cemuzunlar,

I'm using the latest update. Maybe I'm doing something wrong somewhere. I'll send over the files so that you can have a look.

Thanks!
geraldyeo
Posts: 9
Joined: 09 Feb 2011, 11:40

Postby geraldyeo » 22 Feb 2011, 03:14

Hi cemuzunlar,

1) Not using custom server source code, using the game room functionality
2) Flash & iOS source <http://dl.dropbox.com/u/276096/iOS_fl_webcam.zip>
3) No test files, using webcam stream from Flash client
4) 2.0.0-RC1b

Let me know where I'm going wrong, and I'll try to fix it.

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

Postby Lapo » 22 Feb 2011, 15:23

Code: Select all

3) No test files, using webcam stream from Flash client

I don't know if it makes much sense. SFS is not meant for streaming, but anyways in theory it should work, I agree although the final result might be not so good.
Out of curiosity... do you decode the Flash video on the iphone at runtime?
Lapo

--

gotoAndPlay()

...addicted to flash games
geraldyeo
Posts: 9
Joined: 09 Feb 2011, 11:40

Postby geraldyeo » 23 Feb 2011, 08:44

Hi Lapo,

I know SFS is not meant for streaming, but I want to do a proof of concept on the possibilities. I'm aware that the quality may not be good.

Yes, I'm thinking of decoding the images at runtime on the iPhone. However, in the source files i sent i've not reach that stage yet, because iPhone sim is crashing on me.
User avatar
cemuzunlar
Posts: 47
Joined: 26 Dec 2008, 00:45
Contact:

Postby cemuzunlar » 23 Feb 2011, 09:03

geraldyeo, we are currently checking the example source you've sent. Thanks.
Cem Uzunlar

Infosfer Game and Visualization Technologies

http://www.infosfer.com

contact@infosfer.com
User avatar
cemuzunlar
Posts: 47
Joined: 26 Dec 2008, 00:45
Contact:

Postby cemuzunlar » 23 Feb 2011, 11:14

We checked your sources. We are pretty sure that you are somehow using the old API.

Because, there is no -lz flag in your Other Linked Flags, and if you were using the new API, you couldn't compile your project successfully without adding it.

So please search and remove all files related to the old SFS2X iPhone API, then download and install the new SFS2X iPhone API and make sure that your project is actually using those files.
Cem Uzunlar

Infosfer Game and Visualization Technologies

http://www.infosfer.com

contact@infosfer.com
geraldyeo
Posts: 9
Joined: 09 Feb 2011, 11:40

Postby geraldyeo » 01 Mar 2011, 02:51

Hi cemuzunlar,

I've removed and re-added the SFS2x and TouchXML folder to my project, and added -lxml2 -lz to Other Linker Flags.

It seems that I need to build with Release, because it doesn't crash. Maybe that's what's needed?

Also, in my viewcontroller I've the <ISFSEvents> so that I can capture the objectMessage events " - (void)onObjectMessage:(SFSEvent *)evt", but it isn't triggering. I couldn't find an example in your help documents, so if you could let me know if there is one or if I did something wrongly?

Thanks!
geraldyeo
Posts: 9
Joined: 09 Feb 2011, 11:40

Postby geraldyeo » 01 Mar 2011, 06:30

Well, I sort of got it working now. I can see the B64 strings being passed. I'll carry on my experiment and post my findings.

Thanks for all your help guys!
User avatar
cemuzunlar
Posts: 47
Joined: 26 Dec 2008, 00:45
Contact:

Postby cemuzunlar » 01 Mar 2011, 06:54

Great!
Cem Uzunlar

Infosfer Game and Visualization Technologies

http://www.infosfer.com

contact@infosfer.com

Return to “SFS2X Questions”

Who is online

Users browsing this forum: DerikFent, JerodSa and 17 guests