Skip to content

send bytes using PostgreSQL user defined function to TCP/IP socket

License

Notifications You must be signed in to change notification settings

AbdulYadi/pgsocket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pgsocket

This project is compiled in Linux against PostgreSQL version 10.
$ make clean
$ 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.

About

send bytes using PostgreSQL user defined function to TCP/IP socket

Resources

License

Stars

Watchers

Forks

Packages

No packages published