[SOLVED] WebSockets client giving Access Violation lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- Graham1 · 2023-12-14 22:49 I have downloaded the WebSockets files from https://github.com/Warfley/LazWebsockets and tried using them. First I amended the chatClient.pas line to be: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   client := TWebsocketClient.Create('192.168.1.11', 8888); Then I complied it (with Laz 2.0.12) and ran it on my Win10 64bit PC. But I get an Access Violation error: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i An unhandled exception occurred at $0000000100001EC8:EAccessViolation: Access violation  $0000000100001EC8  DESTROY,  line 93 of chatClient.pas  $0000000100001E4F  CREATE,  line 89 of chatClient.pas  $000000010000207A  main,  line 106 of chatClient.pas  $00000001000020C6  main,  line 115 of chatClient.pas  $0000000100010B20  $0000000100001840  $00007FF82D587344  $00007FF82F1E26B1 I also tried the chatClient.html file having changed the line to: Code: Javascript  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     var wsAddr = "ws://192.168.1.11:8888/"; and that ran fine, connecting and sending/receiving OK. I tried breaking down the Create step into: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  client: TWebsocketClient;  sockHand : TSocketHandler;  sockComm : TWebsocketCommunicator;  chat: TSimpleChat; BEGIN    writeln('Try 1');   try      client := TWebsocketClient.Create('192.168.1.11', 8888);   except      writeln('Error at 1');   end;    writeln('Try 2');   try      sockHand := TSocketHandler.Create;   except      writeln('Error at 2');   end;    writeln('Try 3');   try      sockComm := client.Connect(sockHand);   except      writeln('Error at 3');   end;    writeln('Try 4');   try      chat := TSimpleChat.Create(sockComm);   except      writeln('Error at 4');   end;    chat.Free;   sockComm.Free;   sockHand.Free;   client.Free; END. and I get the message 'Error at 4'. I then tried adding the line: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i    writeln(booltostr(sockComm.Open)); before the 'Try 4' line and it gave an error there too. So there seems to be something wrong with creating the Communicator. I don't really know where to start looking to fix this. Thanks! ---------------------------------------------------------------------- Graham1 · 2023-12-16 04:00 It seems the Master version is broken. There is another message on this forum (https://forum.lazarus.freepascal.org/index.php/topic,65547.0.html) where user BlueIcaro was having a problem with his WebSockets client program. I downloaded his project and found it opened and sent/received OK. So I checked his program against mine and couldn't see anything significant that was different until I thought of comparing the main websocket library files. He seems to have fixed them for the Access Violation error I was getting, or they are an older version that used to work. So my problem is fixed. But now I have the same problem as him....