c++ - a socket and queue problem -


i have code:

a declaration of queue:

typedef deque<char*, allocator<char*> > chardeque; typedef queue<char*,chardeque> charqueue;  charqueue p; size_t size_q; char recv_data[1024]; 

i use udp socket receive data distant machine:

this loop:

while (1) {          bytes_read = recvfrom(sock,recv_data,1024,0, (struct sockaddr *)&client_addr, &addr_len);          p.push(recv_data);         size_q=p.size();         printf("%d\n",size_q);       } 

but problem size of queue doesen't grow it's same, see on screen

 0     40     40     40     40     40     ... 

for more information, program receiving raw data, that's why use char array.. ideas how fix this?

sizeof determined in compilation time. mean p.size().


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -