Sign in to follow this  

Array of struct information.

This topic is 4360 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
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

This topic is 4360 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.

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