Sometimes I don't understand Lazarus. It is like pulling your hair or teeth. Why is it that I can't send any data using LNET? I wrote a mini program that is supposed to be run on two different system and these systems are communicating with each other through ad-hoc wifi connection. It successfully connects to the other system. However, as soon as I send any data, the program automatically disconnects and then it puts out a message, "Error on connect: connection refused." The weird thing is the server receives the send data, but the client disconnects IMMEDIATELY. I looked at the other posts in this forum and they don't seem to help. For the life of me, I simply can't figure this one out. Any help or hint will be greatly appreciated. Thank you.
Client:
TFileRequest = record
FileName:String[40];
FileSize: Integer;
end;
var fff:TFileRequest;
FNet.Connect('10.1.1.2', 4431);
fff.FileName := 'Testfile.txt';
fff.FileSize := 200;
FNet.Send(fff,SizeOf(fff), FNET.Iterator);
Server:
TFileRequest = record
FileName:String[40];
FileSize: Integer;
end;
var fff:TFileRequest;
FNet.Listen(4431);
procedure Mainfrm.FNETReceive(aSocket:TLSocket);
begin
FNet.get(fff,SizeOf(fff));
end;