Try TTCPBlockSocket instead of TBlockSocket.
From: "synalist-public-requ...@lists.sourceforge.net"
<synalist-public-requ...@lists.sourceforge.net>
To: synalist-public@lists.sourceforge.net
Sent: Friday, January 19, 2018 8:31 AM
Subject: synalist-public Digest, Vol 121, Issue 1
Send synalist-public mailing list submissions to
synalist-public@lists.sourceforge.net
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sourceforge.net/lists/listinfo/synalist-public
or, via email, send a message with subject or body 'help' to
synalist-public-requ...@lists.sourceforge.net
You can reach the person managing the list at
synalist-public-ow...@lists.sourceforge.net
When replying, please edit your Subject line so it is more specific
than "Re: Contents of synalist-public digest..."
Today's Topics:
1. TCP socket not created (Jon)
2. Re: TCP socket not created (Jon)
----------------------------------------------------------------------
Message: 1
Date: Fri, 19 Jan 2018 13:15:48 +0000 (UTC)
From: Jon <jon.t...@yahoo.com>
To: "synalist-public@lists.sourceforge.net"
<synalist-public@lists.sourceforge.net>
Subject: [Synalist] TCP socket not created
Message-ID: <1618149966.788272.1516367748...@mail.yahoo.com>
Content-Type: text/plain; charset="utf-8"
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?
-------------- next part --------------
An HTML attachment was scrubbed...
------------------------------
Message: 2
Date: Fri, 19 Jan 2018 13:26:53 +0000 (UTC)
From: Jon <jon.t...@yahoo.com>
To: Ararat Synapse <synalist-public@lists.sourceforge.net>
Subject: Re: [Synalist] TCP socket not created
Message-ID: <1428613834.775195.1516368413...@mail.yahoo.com>
Content-Type: text/plain; charset="utf-8"
FYI, it is the same with official release 40 from here:
https://sourceforge.net/code-snapshots/svn/s/sy/synalist/code/synalist-code-150-trunk.zip
$ fpc test.lprFree Pascal Compiler version 3.0.4+dfsg-2~bpo9+1 [2017/11/18] for
x86_64Copyright (c) 1993-2017 by Florian Klaempfl and othersTarget OS: Linux
for x86-64Compiling test.lprCompiling blcksock.pasCompiling
synafpc.pasCompiling synsock.passsfpc.inc(698,26) Warning: Symbol "HostToNet"
is deprecatedssfpc.inc(808,18) Warning: Symbol "HostToNet" is
deprecatedssfpc.inc(868,25) Warning: Symbol "NetToHost" is deprecatedCompiling
synautil.passynautil.pas(609,51) Warning: Symbol "TimeSeparator" is
deprecatedsynautil.pas(1922,3) Note: Local variable "BackStop" is assigned but
never usedsynautil.pas(2062,43) Warning: Symbol "ShortMonthNames" is
deprecatedsynautil.pas(2063,42) Warning: Symbol "ShortMonthNames" is
deprecatedCompiling synacode.pasCompiling synaip.pasLinking
test/usr/bin/ld.bfd: warning: link.res contains output sections; did you forget
-T?9432 lines compiled, 0.4 sec6 warning(s) issued1 note(s) issued$
./testcreate:connect: Bad file numbersend: Bad file numberfinally: Bad file
number$
Not sure what else to try or how to get better logs.
On Friday, 19 January 2018, 13:20, Jon via synalist-public
<synalist-public@lists.sourceforge.net> wrote:
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.lprFree Pascal Compiler version 3.0.4+dfsg-2~bpo9+1 [2017/11/18] for
x86_64Copyright (c) 1993-2017 by Florian Klaempfl and othersTarget OS: Linux
for x86-64Compiling test.lprCompiling blcksock.pasCompiling
synafpc.pasCompiling synsock.passsfpc.inc(714,26) Warning: Symbol "HostToNet"
is deprecatedssfpc.inc(824,18) Warning: Symbol "HostToNet" is
deprecatedssfpc.inc(884,25) Warning: Symbol "NetToHost" is deprecatedCompiling
synautil.passynautil.pas(637,96) Warning: Symbol "TimeSeparator" is
deprecatedsynautil.pas(1981,3) Note: Local variable "BackStop" is assigned but
never usedsynautil.pas(2121,88) Warning: Symbol "ShortMonthNames" is
deprecatedsynautil.pas(2122,87) Warning: Symbol "ShortMonthNames" is
deprecatedCompiling synacode.pasCompiling synaip.pasLinking
test/usr/bin/ld.bfd: warning: link.res contains output sections; did you forget
-T?11013 lines compiled, 0.4 sec6 warning(s) issued1 note(s) issued$
./testcreate:connect: Bad file numbersend: Bad file numberfinally: 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 23Trying 192.168.254.254...Connected to
192.168.254.254.Escape character is '^]'.{1@1}(O01 I01)^]telnet> quitConnection
closed.$
Any suggestions on what could be wrong?
------------------------------------------------------------------------------Check
out the vibrant tech community on one of the world's mostengaging tech sites,
Slashdot.org!
http://sdm.link/slashdot_______________________________________________synalist-public
mailing
listsynalist-public@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/synalist-public
-------------- next part --------------
An HTML attachment was scrubbed...
------------------------------
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
------------------------------
Subject: Digest Footer
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public
------------------------------
End of synalist-public Digest, Vol 121, Issue 1
***********************************************
------------------------------------------------------------------------------
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