pgsocket

April 12, 2019 ยท View on GitHub

This project is compiled in Linux against PostgreSQL version 10.
makeclean<br/>make clean<br /> make
$ make install

On successful compilation, install this extension in PostgreSQL environment
$ create extension pgsocket

Let us send bytes to --for example-- host with IP address nnn.nnn.nnn.nnn, port 9090, send time out 30 seconds, messages "Hello"
$ select pgsocketsend('nnn.nnn.nnn.nnn', 9090, 30, (E'\\x' || encode('Hello', 'hex'))::bytea);

Or using address host name instead of IP address
$ select pgsocketsend('thesocketserver', 9090, 30, (E'\\x' || encode('Hello', 'hex'))::bytea);

To send message to and read response (started with STX and ended with ETX only) from host, send time out 30 seconds, read time out 40 seconds
$ select pgsocketsendrcvstxetx('thesocketserver', 9090, 30, 40, (E'\\x' || encode('Hello', 'hex'))::bytea);
The returned message is in bytea.