Jump to content
  • Advertisement
Sign in to follow this  
neilski_2003

Array of struct information.

This topic is 4669 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, i'm a bit of a novice so forgive any glaring errors that i may have made. Basically i am trying to write an asynchronous client/server (i know the subject should be in network programming but the question doesn't really relate to the networking side of it). Anyhow i currently have a struct which i believe should hold the socket number and sockaddr_in info of any new clients that connect. It looks a little something like this

struct ClienEntry
{
	int sock_number;
	SOCKADDR_IN client;
}


Now what i want to do is create an array which stores this information so that i can refer to it at a later date What i have attempted just plain doesn't work but here it is so ytou know i have tried
[source lang ="cpp"]

struct ClientEntry  ClientEntryList[MAX_CLIENTS];


So can anyone help me on how to create an array that holds the information stored in the ClientEntry struct. Thanks for your help in advance. Neil

Share this post


Link to post
Share on other sites
Advertisement
Correct me if I'm wrong, but "struct ClientEntry ClientEntryList[MAX_CLIENTS];" seems like C to me. In Cpp you don't have to use the struct keyword when you declare the array.

Share this post


Link to post
Share on other sites
so just get rid of the struct decleration and have

ClientEntry ClientEntryList[32]

and that will create an array called ClientEntryList with room for 32 ClientEntry objects?

I told you i was a novice! :p!

Cheers
Neil

Share this post


Link to post
Share on other sites
0) Have you checked for typos (like 'clienList', or the fact that you need a semicolon at the end of a struct or class declaration)?

1) Define "doesn't work".

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!