I understand about pulling the stream, but I'm having trouble connecting to the PLC. This is what I have to connect to the PLC.
procedure UDPConnect;
var
DataArray : array of byte ;
IpString: String;
IpPort : integer;
begin
setlength(DataArray,102);
IpPort := 23;
if FileExists(ExtractFilePath(Application.ExeName) + addressFile) then
begin
SetCurrentDir(ExtractFilePath(Application.ExeName)); //set the current directory to find the IPaddress list .txt file
AssignFile(AddListFile, addressFile);
Reset(AddListFile); //open file for reading
ReadLn(AddListFile,IpString);
MainForm.IpAddress.Caption := IpString; //display the first address from the IPaddress File
MainForm.IpAddress.Visible := true;
MainForm.UDPServ.SendBuffer(IpString,IpPort,DataArray[1],length(DataArray)); //connect to the PLC
CloseFile(AddListFile);
end;
end;
I think the variable names are pretty self explanatory, It just doesn't connect to the PLC, when I use the local IP it works but when I use the PLC IP it doesn't connect to anything. Do I have to add anything or change anything?