Initial
This commit is contained in:
24
socket/SERVENT.CPP
Normal file
24
socket/SERVENT.CPP
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <socket/servent.hpp>
|
||||
|
||||
WORD ServEnt::serviceByName(const String &serviceName,const String &protocol)
|
||||
{
|
||||
struct servent *lpServent;
|
||||
|
||||
if(0==(lpServent=::getservbyname((LPSTR)serviceName,(LPSTR)protocol)))return FALSE;
|
||||
pureServiceName(lpServent->s_name);
|
||||
purePort(lpServent->s_port);
|
||||
pureAliases(lpServent->s_aliases);
|
||||
pureProtocol(lpServent->s_proto);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void ServEnt::pureAliases(char **lpAliases)
|
||||
{
|
||||
mAliasNames.remove();
|
||||
if(!lpAliases)return;
|
||||
while(*(lpAliases))
|
||||
{
|
||||
mAliasNames.insert(&String(*lpAliases));
|
||||
lpAliases++;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user