Sign in to follow this  
themadme

finding servers

Recommended Posts

Hi. IN my application i want to have clients to search for a server with a certain name. I am using WinSock, c++. i have read about using WSASERVICECLASSINFO and WSANSCLASSINFO to create a service class has anyone done any of that or did something differently? Please Help thanks

Share this post


Link to post
Share on other sites
Quote:
Original post by themadme
Hi.

IN my application i want to have clients to search for a server with a certain name.

I am using WinSock, c++.

i have read about using WSASERVICECLASSINFO and WSANSCLASSINFO to create a service class

has anyone done any of that or did something differently?

Please Help

thanks
What sort of server? Is it a server that you've written? Is it on the local network or is it on the Internet?

Share this post


Link to post
Share on other sites
Its UDP socket that i have created which is the server part for my application

memset( &sockAddress, NULL, sizeof(sockAddress) );
sockAddress.sin_family = AF_INET;
sockAddress.sin_port = usPortNumber;
sockAddress.sin_addr.s_addr = htonl(INADDR_ANY);

///** bind the socket **/////
if ( bind( socketUser, (SOCKADDR*)&sockAddress, sizeof(sockAddress) ) == SOCKET_ERROR )
{
closesocket( socketUser );
return false;
}

basically for now its being used for a local network

Share this post


Link to post
Share on other sites
Quote:
Original post by themadme
Its socket that i have created which is the server part for my application
And are the clients connecting to it on the Internet or a local network? There's no concept of "server names", you need to connect to an IP address. You can send a broadcast UDP packet to send a packet to all PCs on a network, but this doesn't work across the Internet (for obvious reasons), so you can use that to search for servers on a local network (The server needs to listen for UDP packets and reply with details about itself to the sender of the packet).

For Internet usage, you'll have to have some sort of matchmaking server, which clients can connect to and request a list of active servers - that's another server that you'd write yourself, and you'd host on a server with a known IP / domain name.

Share this post


Link to post
Share on other sites
thanks for the replies and the link :)

the clients will also be on the local network. I was just wondering how does service class registration works?

so is there any examples or documentation on to broadcast, i would be very grateful.

thanks

Share this post


Link to post
Share on other sites
Quote:
Original post by themadme

I was just wondering how does service class registration works?


The things you're referring to are part of Winsock SPI, which is extension mechanism. It allows you write services for winsock, such as packet shaping, packet inspection, provide custom IP transports and similar.

It's a completely unrelated topic for your purposes.

Share this post


Link to post
Share on other sites
ahhh alright then , thank you very much for the reply... So broadcasting is my only choice for client on a local network to find a server on the same network.

There is no other method that could be used?

thanks

[Edited by - themadme on November 13, 2008 4:14:26 AM]

Share this post


Link to post
Share on other sites

If you can't use a central registry (matchmaker, or DNS server), then you have to use broadcast of some sort.

If you follow the Forum FAQ, it links you to mDNS / Rendez-Vous, which is a library that does all that for you (and is what's used for iTunes, for example).

Share this post


Link to post
Share on other sites

If you can't use a central registry (matchmaker, or DNS server), then you have to use broadcast of some sort.

If you follow the Forum FAQ, it links you to mDNS / Rendez-Vous, which is a library that does all that for you (and is what's used for iTunes, for example).

Share this post


Link to post
Share on other sites
yeah i cant sadly to say, not for what im doing sigh. I think ill use the multi casting method.

thanks for all the replies and the links, thanks

[Edited by - themadme on November 15, 2008 6:47:19 AM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this