fahimeh1512
دوشنبه 28 بهمن 1392, 18:50 عصر
سلام
دوستان من کدی رو دارم میخونم که برای سوکت نویسیه تو این کد چنین چیزی داریم
typedef struct msevent msevent;
.
.
.
struct msevent {
nsock_event_id id; /* Every event has an ID which is unique for a given nsock
unless you blow through more than 500,000,000 events */
enum nse_type type;
enum nse_status status;
struct filespace iobuf; /* for write events, this is the data to be written,
for read events, this is what we will read into */
struct timeval timeout; /* The timeout of the event -- absolute time
except that tv_sec == 0 means no timeout */
struct readinfo readinfo; /* Info pertaining to READ requests */
struct writeinfo writeinfo; /* Info pertaining to WRITE requests */
#if HAVE_OPENSSL
struct sslinfo sslinfo;
#endif
int errnum; /* If we return a status of NSE_STATUS_ERROR, this must be set */
int eof;
msiod *iod; /* The nsock I/O descriptor related to event (if applicable) */
nsock_ev_handler handler; /* The handler to call when event is complete */
void *userdata;
int event_done; /* If this event is all filled out and ready for
immediate delivery, event_done is nonzero. Used
when event is finished at unexpected time and we
want to dispatch it later to avoid duplicating
stat update code and all that other crap */
struct timeval time_created;
};
شما چنین چیزی رو چجوری توجیه میکنید؟ استراکچری که پایین تعریفشو گذاشته کدوم یکی از اون دوتاست که هم نام هستن؟؟ و اصلا چطور میشه با تایپ دیف یه تایپ جدید از یه نوعی بسازیم که خودش هنوز تعریف نشده؟
ضمنا هدر winsock.h و لایبرری Ws2_32.lib هم به برنامه اضافه شدن
به نظرتون تعریف نوع اصلی تو ایناست؟:متفکر:
دوستان من کدی رو دارم میخونم که برای سوکت نویسیه تو این کد چنین چیزی داریم
typedef struct msevent msevent;
.
.
.
struct msevent {
nsock_event_id id; /* Every event has an ID which is unique for a given nsock
unless you blow through more than 500,000,000 events */
enum nse_type type;
enum nse_status status;
struct filespace iobuf; /* for write events, this is the data to be written,
for read events, this is what we will read into */
struct timeval timeout; /* The timeout of the event -- absolute time
except that tv_sec == 0 means no timeout */
struct readinfo readinfo; /* Info pertaining to READ requests */
struct writeinfo writeinfo; /* Info pertaining to WRITE requests */
#if HAVE_OPENSSL
struct sslinfo sslinfo;
#endif
int errnum; /* If we return a status of NSE_STATUS_ERROR, this must be set */
int eof;
msiod *iod; /* The nsock I/O descriptor related to event (if applicable) */
nsock_ev_handler handler; /* The handler to call when event is complete */
void *userdata;
int event_done; /* If this event is all filled out and ready for
immediate delivery, event_done is nonzero. Used
when event is finished at unexpected time and we
want to dispatch it later to avoid duplicating
stat update code and all that other crap */
struct timeval time_created;
};
شما چنین چیزی رو چجوری توجیه میکنید؟ استراکچری که پایین تعریفشو گذاشته کدوم یکی از اون دوتاست که هم نام هستن؟؟ و اصلا چطور میشه با تایپ دیف یه تایپ جدید از یه نوعی بسازیم که خودش هنوز تعریف نشده؟
ضمنا هدر winsock.h و لایبرری Ws2_32.lib هم به برنامه اضافه شدن
به نظرتون تعریف نوع اصلی تو ایناست؟:متفکر: