WhatsAPP demo access violation after receiving message

Hello, I'm playing with de WhatsApp demo using websocket and I'm getting an access violation on server after receiving a message.

VCL.TMSFNCWebSocketServer 862 +1 TTMSFNCWebSocketServerConnection.GetPeerIP
u_main 253 +1 TFrmMain.WAS_OnDisconnect
VCL.TMSFNCWebSocketServer 737 +2 TMSFNCCustomWebSocketServer.HTTPServerDisconnect$ActRec.$0$Body

Using Delphi 10.2.3,
Version of TMS FNC Cloud Pack
Version of TMS FNC WebSocket

Thanks for your help


Job Espejel


Which demo is this? The WhatsApp receiver demo we created with TMS FNC WebSocket is an FMX application but based on the messages you pasted here you are working with a VCL project? Did you try to recreate the demo in VCL?

Hello, I forgot to mention that the error is present in the original demo for FMX, then I recreated the demo for VCL, with the same error.


Job Espejel

exception message : Access violation at address 00B19B8C in module 'TMSFNCWhatsAppServer.exe'. Read of address 000000B8.

main thread ($e50):
00b19b8c +014 TMSFNCWhatsAppServer.exe FMX.TMSFNCWebSocketServer 862 +1 TTMSFNCWebSocketServerConnection.GetPeerIP
00b4a27b +02b TMSFNCWhatsAppServer.exe Main 84 +1 TForm1.TMSFNCWhatsAppServer1Disconnect
00b1951c +030 TMSFNCWhatsAppServer.exe FMX.TMSFNCWebSocketServer 737 +2 TTMSFNCCustomWebSocketServer.HTTPServerDisconnect$ActRec.$0$Body
0053b846 +13a TMSFNCWhatsAppServer.exe System.Classes 14893 +32 CheckSynchronize
00923f2b +00f TMSFNCWhatsAppServer.exe FMX.Platform.Win 3883 +3 TPlatformWin.ThreadSync
0053f2dc +014 TMSFNCWhatsAppServer.exe System.Classes 17405 +8 StdWndProc
75bd5f7b +00b USER32.dll DispatchMessageW
0091c273 +02f TMSFNCWhatsAppServer.exe FMX.Platform.Win 705 +8 TPlatformWin.HandleMessage
0099e5bf +03b TMSFNCWhatsAppServer.exe FMX.Forms 1842 +3 TApplication.HandleMessage
0091c072 +03a TMSFNCWhatsAppServer.exe FMX.Platform.Win 643 +6 TPlatformWin.Run
0099efa3 +03f TMSFNCWhatsAppServer.exe FMX.Forms 2165 +3 TApplication.Run
00b5e193 +03b TMSFNCWhatsAppServer.exe TMSFNCWhatsAppServer 18 +3 initialization
76aa00f7 +017 KERNEL32.DLL BaseThreadInitThunk

It seems like you implemented the OnDisconnect event, is that correct?

There was an issue with events being synchronized with the main thread automatically. We've added a property to disable this (although this way you need to sync any UI element manipulation yourself).

This fix was not yet released.

Thanks, meanwhile I disabled the OnDisconnect event.