Openedge use Windows service name to connect to port












0















I'm trying to write a program that will test a Linux port to see if it's listening. The program runs on a Windows box and the port number could be variable, depending on the service selected. I'm need to look up the port number using the Windows Service file.
Below is my procedure:



define input parameter ip-network-id as char no-undo.
DEFINE VARIABLE hSocket AS HANDLE NO-UNDO.
DEFINE VARIABLE cService AS CHARACTER NO-UNDO.
DEFINE VARIABLE cHostName AS CHARACTER NO-UNDO.
DEFINE VARIABLE lResult AS LOGICAL NO-UNDO.

CREATE SOCKET hSocket.

GET-KEY-VALUE SECTION "DATABASE" KEY "dbhostname" VALUE cHostName.

ASSIGN
cService = "txipd" + ip-network-id /*ip-network-id = "fis" */
lResult = hSocket:CONNECT("-H " + cHostName + " -S " + cService) NO-ERROR.

IF lResult THEN do:
MESSAGE cHostName "is accepting Cilent/Server connections on" cService " ."
VIEW-AS ALERT-BOX INFO BUTTONS OK.

/* Once done with the database disconnect and delete the object */
hSocket:DISCONNECT() NO-ERROR.
DELETE OBJECT hSocket NO-ERROR.
end.
Else
MESSAGE "The Database is not listening on this port" cService lResult cHostName
VIEW-AS ALERT-BOX INFO BUTTONS OK.


My Windows Services file contains the follow entry:



txipdfis        31357/tcp


ip-network-id could equal one of many options selected from a browse, the service txipdfis might be on a different port number depending on how the particular installation was setup so I need to look for "txipdfis" in the Windows service file to determine the correct port number. Is this possible?










share|improve this question

























  • It ought to work -- if it isn't working are you getting an error message?

    – Tom Bascom
    Jan 2 at 17:36











  • This code works in my environment when I hardcode hostname and service! Perhaps wrong data in the registry or a routing issue, local firewall etc

    – Jensd
    Jan 10 at 11:39






  • 1





    Does your entry happen to be the last line in your services file? If so, you may need to add an enter (crlf).

    – Stefan Drissen
    Jan 15 at 22:21











  • @StefanDrissen my entry was the last in the services file, I added a CRLF and tested again, still not able to connect. I don't seem to get any "errors" except the message that says the nothing is listening on the port. This got me thinking.... what if there's not a database actually listening on that port on the Linux side. What if it's a program that's listening, would that be an issue? I'm really only aiming to check that something is listening on that port, not exactly a database.

    – John Haffenreffer
    Jan 23 at 19:27













  • @StefanDrissen, on my second attempt after adding the CRLF, I am actually able to connect!

    – John Haffenreffer
    Jan 23 at 19:33
















0















I'm trying to write a program that will test a Linux port to see if it's listening. The program runs on a Windows box and the port number could be variable, depending on the service selected. I'm need to look up the port number using the Windows Service file.
Below is my procedure:



define input parameter ip-network-id as char no-undo.
DEFINE VARIABLE hSocket AS HANDLE NO-UNDO.
DEFINE VARIABLE cService AS CHARACTER NO-UNDO.
DEFINE VARIABLE cHostName AS CHARACTER NO-UNDO.
DEFINE VARIABLE lResult AS LOGICAL NO-UNDO.

CREATE SOCKET hSocket.

GET-KEY-VALUE SECTION "DATABASE" KEY "dbhostname" VALUE cHostName.

ASSIGN
cService = "txipd" + ip-network-id /*ip-network-id = "fis" */
lResult = hSocket:CONNECT("-H " + cHostName + " -S " + cService) NO-ERROR.

IF lResult THEN do:
MESSAGE cHostName "is accepting Cilent/Server connections on" cService " ."
VIEW-AS ALERT-BOX INFO BUTTONS OK.

/* Once done with the database disconnect and delete the object */
hSocket:DISCONNECT() NO-ERROR.
DELETE OBJECT hSocket NO-ERROR.
end.
Else
MESSAGE "The Database is not listening on this port" cService lResult cHostName
VIEW-AS ALERT-BOX INFO BUTTONS OK.


My Windows Services file contains the follow entry:



txipdfis        31357/tcp


ip-network-id could equal one of many options selected from a browse, the service txipdfis might be on a different port number depending on how the particular installation was setup so I need to look for "txipdfis" in the Windows service file to determine the correct port number. Is this possible?










share|improve this question

























  • It ought to work -- if it isn't working are you getting an error message?

    – Tom Bascom
    Jan 2 at 17:36











  • This code works in my environment when I hardcode hostname and service! Perhaps wrong data in the registry or a routing issue, local firewall etc

    – Jensd
    Jan 10 at 11:39






  • 1





    Does your entry happen to be the last line in your services file? If so, you may need to add an enter (crlf).

    – Stefan Drissen
    Jan 15 at 22:21











  • @StefanDrissen my entry was the last in the services file, I added a CRLF and tested again, still not able to connect. I don't seem to get any "errors" except the message that says the nothing is listening on the port. This got me thinking.... what if there's not a database actually listening on that port on the Linux side. What if it's a program that's listening, would that be an issue? I'm really only aiming to check that something is listening on that port, not exactly a database.

    – John Haffenreffer
    Jan 23 at 19:27













  • @StefanDrissen, on my second attempt after adding the CRLF, I am actually able to connect!

    – John Haffenreffer
    Jan 23 at 19:33














0












0








0








I'm trying to write a program that will test a Linux port to see if it's listening. The program runs on a Windows box and the port number could be variable, depending on the service selected. I'm need to look up the port number using the Windows Service file.
Below is my procedure:



define input parameter ip-network-id as char no-undo.
DEFINE VARIABLE hSocket AS HANDLE NO-UNDO.
DEFINE VARIABLE cService AS CHARACTER NO-UNDO.
DEFINE VARIABLE cHostName AS CHARACTER NO-UNDO.
DEFINE VARIABLE lResult AS LOGICAL NO-UNDO.

CREATE SOCKET hSocket.

GET-KEY-VALUE SECTION "DATABASE" KEY "dbhostname" VALUE cHostName.

ASSIGN
cService = "txipd" + ip-network-id /*ip-network-id = "fis" */
lResult = hSocket:CONNECT("-H " + cHostName + " -S " + cService) NO-ERROR.

IF lResult THEN do:
MESSAGE cHostName "is accepting Cilent/Server connections on" cService " ."
VIEW-AS ALERT-BOX INFO BUTTONS OK.

/* Once done with the database disconnect and delete the object */
hSocket:DISCONNECT() NO-ERROR.
DELETE OBJECT hSocket NO-ERROR.
end.
Else
MESSAGE "The Database is not listening on this port" cService lResult cHostName
VIEW-AS ALERT-BOX INFO BUTTONS OK.


My Windows Services file contains the follow entry:



txipdfis        31357/tcp


ip-network-id could equal one of many options selected from a browse, the service txipdfis might be on a different port number depending on how the particular installation was setup so I need to look for "txipdfis" in the Windows service file to determine the correct port number. Is this possible?










share|improve this question
















I'm trying to write a program that will test a Linux port to see if it's listening. The program runs on a Windows box and the port number could be variable, depending on the service selected. I'm need to look up the port number using the Windows Service file.
Below is my procedure:



define input parameter ip-network-id as char no-undo.
DEFINE VARIABLE hSocket AS HANDLE NO-UNDO.
DEFINE VARIABLE cService AS CHARACTER NO-UNDO.
DEFINE VARIABLE cHostName AS CHARACTER NO-UNDO.
DEFINE VARIABLE lResult AS LOGICAL NO-UNDO.

CREATE SOCKET hSocket.

GET-KEY-VALUE SECTION "DATABASE" KEY "dbhostname" VALUE cHostName.

ASSIGN
cService = "txipd" + ip-network-id /*ip-network-id = "fis" */
lResult = hSocket:CONNECT("-H " + cHostName + " -S " + cService) NO-ERROR.

IF lResult THEN do:
MESSAGE cHostName "is accepting Cilent/Server connections on" cService " ."
VIEW-AS ALERT-BOX INFO BUTTONS OK.

/* Once done with the database disconnect and delete the object */
hSocket:DISCONNECT() NO-ERROR.
DELETE OBJECT hSocket NO-ERROR.
end.
Else
MESSAGE "The Database is not listening on this port" cService lResult cHostName
VIEW-AS ALERT-BOX INFO BUTTONS OK.


My Windows Services file contains the follow entry:



txipdfis        31357/tcp


ip-network-id could equal one of many options selected from a browse, the service txipdfis might be on a different port number depending on how the particular installation was setup so I need to look for "txipdfis" in the Windows service file to determine the correct port number. Is this possible?







sockets windows-services openedge progress-4gl






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 2 at 17:36









Tom Bascom

8,37522028




8,37522028










asked Jan 2 at 17:03









John HaffenrefferJohn Haffenreffer

236




236













  • It ought to work -- if it isn't working are you getting an error message?

    – Tom Bascom
    Jan 2 at 17:36











  • This code works in my environment when I hardcode hostname and service! Perhaps wrong data in the registry or a routing issue, local firewall etc

    – Jensd
    Jan 10 at 11:39






  • 1





    Does your entry happen to be the last line in your services file? If so, you may need to add an enter (crlf).

    – Stefan Drissen
    Jan 15 at 22:21











  • @StefanDrissen my entry was the last in the services file, I added a CRLF and tested again, still not able to connect. I don't seem to get any "errors" except the message that says the nothing is listening on the port. This got me thinking.... what if there's not a database actually listening on that port on the Linux side. What if it's a program that's listening, would that be an issue? I'm really only aiming to check that something is listening on that port, not exactly a database.

    – John Haffenreffer
    Jan 23 at 19:27













  • @StefanDrissen, on my second attempt after adding the CRLF, I am actually able to connect!

    – John Haffenreffer
    Jan 23 at 19:33



















  • It ought to work -- if it isn't working are you getting an error message?

    – Tom Bascom
    Jan 2 at 17:36











  • This code works in my environment when I hardcode hostname and service! Perhaps wrong data in the registry or a routing issue, local firewall etc

    – Jensd
    Jan 10 at 11:39






  • 1





    Does your entry happen to be the last line in your services file? If so, you may need to add an enter (crlf).

    – Stefan Drissen
    Jan 15 at 22:21











  • @StefanDrissen my entry was the last in the services file, I added a CRLF and tested again, still not able to connect. I don't seem to get any "errors" except the message that says the nothing is listening on the port. This got me thinking.... what if there's not a database actually listening on that port on the Linux side. What if it's a program that's listening, would that be an issue? I'm really only aiming to check that something is listening on that port, not exactly a database.

    – John Haffenreffer
    Jan 23 at 19:27













  • @StefanDrissen, on my second attempt after adding the CRLF, I am actually able to connect!

    – John Haffenreffer
    Jan 23 at 19:33

















It ought to work -- if it isn't working are you getting an error message?

– Tom Bascom
Jan 2 at 17:36





It ought to work -- if it isn't working are you getting an error message?

– Tom Bascom
Jan 2 at 17:36













This code works in my environment when I hardcode hostname and service! Perhaps wrong data in the registry or a routing issue, local firewall etc

– Jensd
Jan 10 at 11:39





This code works in my environment when I hardcode hostname and service! Perhaps wrong data in the registry or a routing issue, local firewall etc

– Jensd
Jan 10 at 11:39




1




1





Does your entry happen to be the last line in your services file? If so, you may need to add an enter (crlf).

– Stefan Drissen
Jan 15 at 22:21





Does your entry happen to be the last line in your services file? If so, you may need to add an enter (crlf).

– Stefan Drissen
Jan 15 at 22:21













@StefanDrissen my entry was the last in the services file, I added a CRLF and tested again, still not able to connect. I don't seem to get any "errors" except the message that says the nothing is listening on the port. This got me thinking.... what if there's not a database actually listening on that port on the Linux side. What if it's a program that's listening, would that be an issue? I'm really only aiming to check that something is listening on that port, not exactly a database.

– John Haffenreffer
Jan 23 at 19:27







@StefanDrissen my entry was the last in the services file, I added a CRLF and tested again, still not able to connect. I don't seem to get any "errors" except the message that says the nothing is listening on the port. This got me thinking.... what if there's not a database actually listening on that port on the Linux side. What if it's a program that's listening, would that be an issue? I'm really only aiming to check that something is listening on that port, not exactly a database.

– John Haffenreffer
Jan 23 at 19:27















@StefanDrissen, on my second attempt after adding the CRLF, I am actually able to connect!

– John Haffenreffer
Jan 23 at 19:33





@StefanDrissen, on my second attempt after adding the CRLF, I am actually able to connect!

– John Haffenreffer
Jan 23 at 19:33












1 Answer
1






active

oldest

votes


















0














The windows services file did not have a blank line as the last line. Once I updated the services file with a CRLF at the end, I was able to connect.






share|improve this answer
























  • knowledgebase.progress.com/articles/Article/P19596

    – Stefan Drissen
    Jan 24 at 21:44











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54010332%2fopenedge-use-windows-service-name-to-connect-to-port%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














The windows services file did not have a blank line as the last line. Once I updated the services file with a CRLF at the end, I was able to connect.






share|improve this answer
























  • knowledgebase.progress.com/articles/Article/P19596

    – Stefan Drissen
    Jan 24 at 21:44
















0














The windows services file did not have a blank line as the last line. Once I updated the services file with a CRLF at the end, I was able to connect.






share|improve this answer
























  • knowledgebase.progress.com/articles/Article/P19596

    – Stefan Drissen
    Jan 24 at 21:44














0












0








0







The windows services file did not have a blank line as the last line. Once I updated the services file with a CRLF at the end, I was able to connect.






share|improve this answer













The windows services file did not have a blank line as the last line. Once I updated the services file with a CRLF at the end, I was able to connect.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 23 at 19:59









John HaffenrefferJohn Haffenreffer

236




236













  • knowledgebase.progress.com/articles/Article/P19596

    – Stefan Drissen
    Jan 24 at 21:44



















  • knowledgebase.progress.com/articles/Article/P19596

    – Stefan Drissen
    Jan 24 at 21:44

















knowledgebase.progress.com/articles/Article/P19596

– Stefan Drissen
Jan 24 at 21:44





knowledgebase.progress.com/articles/Article/P19596

– Stefan Drissen
Jan 24 at 21:44




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54010332%2fopenedge-use-windows-service-name-to-connect-to-port%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Angular Downloading a file using contenturl with Basic Authentication

Olmecas

Can't read property showImagePicker of undefined in react native iOS