Link to home
Start Free TrialLog in
Avatar of JennyP
JennyP

asked on

Connect to a server

How do I connect to an X400 server? My application needs to connect to the server - check if it is up and then disconnect.
Avatar of adamretter
adamretter

Firstly what protocols are running on your network, what protocols does your x400 server support and what platform are you programming your checking application on.

If TCP/IP is available then you could simply create a small c++ program that does an ICMP ping off of the x400 server to tell if it is switched on and responding to network requests.
Avatar of JennyP

ASKER

TCP/IP is available. I will need to check if the server is up under 2 conditions:
1. ISDN modem dial up
2. over a WAN
How would I do a ping? Simple C++ code that I can include in my program will be great. I will increase points if required.

Two Options
===========

1.)
You need to Use RAW sockets in Windows as far as I can understand.
These are only available under windows 2000/xp and must be executed by someone with Administrator privelledges.

Would this be of any use?

2.) Redirect C++ Standard I/O pipes so that you can simply call ping.exe the dos cmd and use that.


Hi,

How about makeing SNMP request to query system up time?  Assume you can get the community name.
Avatar of JennyP

ASKER

I don't think RAW sockets will be of use 'cos this app will run of various OS Win 9x, Win 2000, etc.

Don't have the community name so I am not sure a SNMP request will work.

How would I redirect Standard I/O pipes? How will I be able to intepret the success or fail from the dos ping command ? I know it returns a reply...but how can I read that from my C++ app?

Please look at this:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q190351

However I myself have not tried before.  Are you sure you want to do this because it is very urgly, for me.

You do not need to have full access right community name, just read-only is good enough.
Avatar of JennyP

ASKER

I am not sure I want to do that. What would you suggest as an alternative? I am looking for a simple way to connect to an X400 server (I have the IP address and port) to check if it is up and running. The function must return a value for my app to interpret if the server is up or down.
>> (I have the IP address and port)

Is it a TCP port? Can you just open a socket and then connect to that IP and port and immediately close it? If socket is opened successfully, we can confirm that server is on.
Avatar of JennyP

ASKER

Yes, it is TCP/IP. What would I use CSocket or similar ? And how ? Excuse my ignorance.
- Open a blocking socket
- Call Connect()
- Check return value whether success or not.
- Close the socket.

Either CSocket or WINSOCK API will do.  
Avatar of JennyP

ASKER

Do we not need to pass any username & password?
ASKER CERTIFIED SOLUTION
Avatar of lsmgms
lsmgms

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Forgot to mention, you have to include Ws2_32.lib library to your project.
Avatar of JennyP

ASKER

This was great. thanks for the help !