Help required please.
Something seems broken with Synapse with FPC 3.0.4 on Debian Linux 64 bit.
Using package downloaded from here:
https://sourceforge.net/code-snapshots/svn/s/sy/synalist/code/synalist-code-207-trunk.zip
Here is a very simple test program:
program socksend;
{$IFDEF FPC}{$MODE DELPHI}{$ENDIF}
uses
BlckSock,sysutils;
var
Sock:TBlockSocket;
begin
Sock := TBlockSocket.Create;
try
Writeln('create: ' + Sock.GetErrorDescEx);
sleep(500);
// Sock.Bind('192.168.254.254','23');
Sock.Connect('192.168.254.254','23');
Writeln('connect: ' + Sock.GetErrorDescEx);
sleep(500);
Sock.SendString('{1@1}'+CRLF);
Writeln('send: ' + Sock.GetErrorDescEx);
sleep(500);
finally
Writeln('finally: ' + Sock.GetErrorDescEx);
Sock.Free;
end;
end.
Running and compiling from terminal:
$ fpc test.lpr
Free Pascal Compiler version 3.0.4+dfsg-2~bpo9+1 [2017/11/18] for x86_64
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling test.lpr
Compiling blcksock.pas
Compiling synafpc.pas
Compiling synsock.pas
ssfpc.inc(714,26) Warning: Symbol "HostToNet" is deprecated
ssfpc.inc(824,18) Warning: Symbol "HostToNet" is deprecated
ssfpc.inc(884,25) Warning: Symbol "NetToHost" is deprecated
Compiling synautil.pas
synautil.pas(637,96) Warning: Symbol "TimeSeparator" is deprecated
synautil.pas(1981,3) Note: Local variable "BackStop" is assigned but never used
synautil.pas(2121,88) Warning: Symbol "ShortMonthNames" is deprecated
synautil.pas(2122,87) Warning: Symbol "ShortMonthNames" is deprecated
Compiling synacode.pas
Compiling synaip.pas
Linking test
/usr/bin/ld.bfd: warning: link.res contains output sections; did you forget -T?
11013 lines compiled, 0.4 sec
6 warning(s) issued
1 note(s) issued
$ ./test
create:
connect: Bad file number
send: Bad file number
finally: Bad file number
$
The equivalent in java works correctly:
import java.io.*;
import java.net.*;
public class TCPClient {
public static void main(String argv[]) throws Exception {
Socket clientSocket = new Socket("192.168.254.254", 23);
clientSocket.setSoTimeout(2000);
DataOutputStream outToServer = new
DataOutputStream(clientSocket.getOutputStream());
outToServer.writeBytes("{1@1}" + "\n");
int c;
InputStream in = clientSocket.getInputStream();
while ((c = in.read()) != -1) {
System.out.print((char) c);
}
clientSocket.close();
}
}
I am able to connect to device and get response:
$ java TCPClient
(O01 I01)
Even basic telnet works fine:
$ telnet 192.168.254.254 23
Trying 192.168.254.254...
Connected to 192.168.254.254.
Escape character is '^]'.
{1@1}
(O01 I01)
^]
telnet> quit
Connection closed.
$
Any suggestions on what could be wrong?
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public