PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV 2024 → How to start Socket connections in stored procedures
How to start Socket connections in stored procedures
Started by Simon Phillips, Dec., 08 2019 3:32 PM - 2 replies
Posted on December, 08 2019 - 3:32 PM
Hi all.

I need to start a Socket connection on my server to connect to an external company. However, the function SocketConnect is not available in Stored Procedures.

Basically what I need to do is:

My customer app connects to my Server and updates a file in C/S. Simple enough.
This would trigger a stored procedure on my server which takes those details and opens up a Socket conversation with one of many companys to check availablity etc.
They then reply to my server with an answer via the socket.
I reply back to my user.

The ideal way would be to directly connect to the Client's databases, but not all will allow that, so Socket conversations seem the best way.

Problem is that my server cannot open a Socket as SocketConnect is not available in the Stored procedures on my server.

The only alternative is for a stored procedure to write the required details to a HF file and then have a separate exe running on the server which is constantly reading the file and doing the socket conversation separatley. This however is a very messy way to have to do this.

Any ideas would be appreciated.

Simon
Posted on December, 11 2019 - 7:42 AM
Hi

An external process that does the connection and transfer is the only real way to do this.

You do not want a socket connection to hold up you database processes, specially when connecting to someone other than yourself.

I would suggest Put all the data or commands into a queue - a file in your case - and process them by means of an external service that runs.

Kind regards
Posted on December, 13 2019 - 12:00 PM
Hi Ben

Thats what I am begining to think. It seems that the only way to do it is as you suggest, to load a temporary file and let the socket app constantly read them. It would be nice if there was a more direct way to get the stored procedure to send a message directly to the Socket app to instruct it to start communicating. However all the function that I have tried (DDE, SendKey) cannot be used in a stored procedure.

Maybe I need to download some more Punjabi tunes to get the brain working!

Simon