Solved

Know UDP services

Posted on 2000-04-14
4
292 Views
Last Modified: 2010-04-02
How do know the UDP services running in a server ? For TCP services we may connect to that port ?

Any Idea how to know UDP services..?

Sanesh
0
Comment
Question by:sanesh
  • 2
4 Comments
 
LVL 9

Expert Comment

by:ShaunWilde
ID: 2716088
'netstat -an' on a server command line will list all the open ports and their status i.e. listening etc
0
 
LVL 9

Expert Comment

by:ShaunWilde
ID: 2716096
you can get their names form system32\drivers\etc\services
0
 

Expert Comment

by:Loggytronic
ID: 2717817
If you're wanting to do this from another computer, I think all you can do is send a message to that port and hope that if there is nothing there then you'll get an ICMP error message back - this translates to your sendto() or equivalent failing with some error. I've seen this, but I'm not sure if it's reliable or not. But this could just be because one of the test machines was windows.
0
 

Accepted Solution

by:
yuxiliu earned 50 total points
ID: 2718470
The socket interface provides a mechanism that allows a client or server to map a protocol name to the integer constant assigned to that progtocol. You can use this way to detect if server is runing with UDP protocol: passes the protocol name(here is UDP) in a string argument, and use "getprotobyname()" returns the address of a structure of type "protoent". if server do not support UDP protocol. it will return "NULL"

just like this:
#include "winsock.h" /*this contains protoent structure.*/

struct protoent *pptr;
if(pptr = getprotobyname("udp"))
{
 /*server supports UDP official protocol number is now in pptr->p_proto*/
}
else
{
  /* server do not support UDP handle it*/
}
}

this also can be used for TCP protocol
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now