Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums

Go Back   Code Forums > Application and Web Development > Platform/API C++

Reply
 
LinkBack Thread Tools Display Modes
Old 04-27-2006, 10:55 PM   #1 (permalink)
jaro
Registered User
 
jaro's Avatar
 
Join Date: Feb 2006
Posts: 9
jaro is on a distinguished road
Question how do I know if a server (on the box) is running?

Hi again,

Lately I'm doing socket programming, as far I can tell it works fine.
the problem is that how do I know if a server (on the box) is running.
The gethostbyname() will only detect if a IP address exist or is currently running.

The only idea that I have is, after gethostbyname() and a successful connect() my program will send some sort of message, then the (workspace)server will then send a valid response. If no valid response is recieve then the process will start all over again.

is this the way to go, just to know if a (workspace)server is running or there is another way ?

regards,
jaro
jaro is offline   Reply With Quote
Old 04-28-2006, 02:26 AM   #2 (permalink)
teknomage1
Jack of all trades
 
teknomage1's Avatar
 
Join Date: Feb 2005
Location: Los Angeles
Posts: 596
teknomage1 is on a distinguished road
Send a message via AIM to teknomage1
Do you have a system function to get search the OS's process table ie the 'ps' command on Unix?
__________________
Stop intellectual property from infringing on me
teknomage1 is offline   Reply With Quote
Old 04-28-2006, 03:17 AM   #3 (permalink)
jaro
Registered User
 
jaro's Avatar
 
Join Date: Feb 2006
Posts: 9
jaro is on a distinguished road
I'm using Windows, my OS is win2K and I'm coding using MVC.
jaro is offline   Reply With Quote
Old 04-28-2006, 07:14 AM   #4 (permalink)
AssKoala
Anti-Zealot
 
AssKoala's Avatar
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 72
AssKoala is on a distinguished road
Send a message via AIM to AssKoala Send a message via MSN to AssKoala Send a message via Yahoo to AssKoala
getaddrinfo() can do it, though not necessarily the best way.

http://msdn.microsoft.com/library/de...addrinfo_2.asp
__________________
If you always think like an expert, you'll always be a beginner. | "A handful of knowledgeable people is more effective than an army of fools" -Writing Secure Code, 2nd Ed.
AssKoala is offline   Reply With Quote
Old 04-28-2006, 07:27 AM   #5 (permalink)
kyoryu
Registered User
 
Join Date: Apr 2003
Posts: 34
kyoryu is on a distinguished road
You want to tell if you've successfully connected or not, correct?

1) connect() will return < 0 if it fails.
2) if you select on a socket, and it returns readable but has no data, it is closed. It helps to think of select not as determining "do I have data available", but "will I block if I do this?" A closed socket won't block, so it will always return as readable and writable.
kyoryu is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Remote server is running my .exe rather than allowing it to be downloaded! TomJ MS Technologies ( ASP, VB, C#, .NET ) 0 05-19-2005 08:05 AM
Terminal Server Help Riverdome Windows 5 12-06-2004 02:22 PM
what language is this? sde All Other Coding Languages 10 05-25-2004 03:57 PM
for anyone running 2003 and cant get OpenGL Timmay Windows 3 07-25-2003 09:53 AM


All times are GMT -8. The time now is 12:03 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting