Socket Connection hangs with incorrect port number

Posted by MBeynon on 02-Jul-2015 03:02

Hi,

I'm writing an application that uses sockets to talk to a server.

The connection parameters are held in a DB: IP address, port number etc...

In case the connection details are stored incorrectly I'm writing code that returns an error to the user if the IP Adresss or port number is wrong i.e. the SOCKET connection fails. This works fine for an incorrect IP address but if the port number is wrong the application hangs. Is this normal?

Here's the code:

lvlStatus = lvhSocket:CONNECT(SUBSTITUTE("-H &1 -S &2 &3 &4":U,
                                        SOCKET_HOST,
                                        SOCKET_PORT,
                                        IF SOCKET_PROTOCOL = {&PROTOCOL_HTTPS} OR SOCKET_PROTOCOL = {&PROTOCOL_HTTPS_UNVERIFIED} THEN "-ssl":U ELSE "":U,
                                        IF SOCKET_PROTOCOL = {&PROTOCOL_HTTPS_UNVERIFIED} THEN "-nohostverify":U ELSE "":U )) NO-ERROR.

I've specified a timeout too (before connecting), but it makes no difference:

      IF SOCKET_TIMEOUT > 0 THEN
        lvhSocket:SET-SOCKET-OPTION("SO-RCVTIMEO", STRING(SOCKET_TIMEOUT)).

Any ideas?

Thanks,

Mark.

All Replies

Posted by gus on 02-Jul-2015 08:19

there is a completely different timeout for connect. i don’t remember if the 4GL socket stuff lets you change that.


regards, knower of even more obscure things.
gus

“In God we trust. All others bring data.” — W. Edwards Deming





> On Jul 2, 2015, at 4:02 AM, MBeynon wrote:
>
>[collapse] From: MBeynon
> Post: Socket Connection hangs with incorrect port number
> Posted in: Forum
> Link: https://community.progress.com/community_groups/openedge_general/f/26/t/18923.aspx
>
> Hi,
> I'm writing an application that uses sockets to talk to a server.
> The connection parameters are held in a DB: IP address, port number etc...
> In case the connection details are stored incorrectly I'm writing code that returns an error to the user if the IP Adresss or port number is wrong i.e. the SOCKET connection fails. This works fine for an incorrect IP address but if the port number is wrong the application hangs. Is this normal?
> Here's the code:
> lvlStatus = lvhSocket:CONNECT(SUBSTITUTE("-H &1 -S &2 &3 &4":U,SOCKET_HOST,SOCKET_PORT,IF SOCKET_PROTOCOL = {&PROTOCOL_HTTPS} OR SOCKET_PROTOCOL = {&PROTOCOL_HTTPS_UNVERIFIED} THEN "-ssl":U ELSE "":U, IF SOCKET_PROTOCOL = {&PROTOCOL_HTTPS_UNVERIFIED} THEN "-nohostverify":U ELSE "":U )) NO-ERROR.
>
> I've specified a timeout too (before connecting), but it makes no difference:
> IF SOCKET_TIMEOUT > 0 THEN lvhSocket:SET-SOCKET-OPTION("SO-RCVTIMEO", STRING(SOCKET_TIMEOUT)).
> Any ideas?
> Thanks,
> Mark.
>
>
> --
> You were sent this email because you opted to receive email notifications when someone created a new thread.
>
> To unsubscribe[collapse] from:
> - ...only this thread, disable notifications at https://community.progress.com/community_groups/openedge_general/f/26/t/18923.aspx.
> - ...all email notifications from Progress Community, navigate to "Settings", click on the "Email" tab, then under the "Email Configuration" section, set Send Notifications to "No".
>[/collapse][/collapse]

Posted by Donicello Lampe on 02-Jul-2015 08:29
Posted by MBeynon on 02-Jul-2015 08:41

Thanks but I'm non SSL and 10.2A...

knowledgebase.progress.com/.../000038830

This thread is closed