Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Buffers in c++ ANYONE HELP ME!!!!

Reply
Thread Tools

Buffers in c++ ANYONE HELP ME!!!!

 
 
williamcorrea85@gmail.com
Guest
Posts: n/a
 
      03-13-2007
hi, I`m doing an application where I use sockets to connect two
differentes machines, but I don`t know how to create the buffers to
receive and to send data

 
Reply With Quote
 
 
 
 
Gianni Mariani
Guest
Posts: n/a
 
      03-13-2007
wrote:
> hi, I`m doing an application where I use sockets to connect two
> differentes machines, but I don`t know how to create the buffers to
> receive and to send data
>


an "array of char" will do. In fact, you can use a std::vector<char>
and size it to the size you want to read (or more).
 
Reply With Quote
 
 
 
 
Sharpen
Guest
Posts: n/a
 
      03-14-2007
On Mar 14, 4:10 am, williamcorre...@gmail.com wrote:
> hi, I`m doing an application where I use sockets to connect two
> differentes machines, but I don`t know how to create the buffers to
> receive and to send data


you define a structure , and set value to the member of this object of
structure,and write code like
"send(s,&your_object_of_structure,sizeof(your_obje ct_of_structure),0)"

 
Reply With Quote
 
Jim Langston
Guest
Posts: n/a
 
      03-18-2007
<> wrote in message
news: ups.com...
> hi, I`m doing an application where I use sockets to connect two
> differentes machines, but I don`t know how to create the buffers to
> receive and to send data


It all depends on what you plan on doing with the buffer. If you plan on
filling it, then passing it to something else, a std::string should be fine.
If you need to buffer messages by some code or something, maybe a
std::vector<std::string>.

A lot of it just depends.


 
Reply With Quote
 
kwikius
Guest
Posts: n/a
 
      03-18-2007
On 18 Mar, 07:42, "Jim Langston" <tazmas...@rocketmail.com> wrote:
> <williamcorre...@gmail.com> wrote in message
>
> news: ups.com...
>
> > hi, I`m doing an application where I use sockets to connect two
> > differentes machines, but I don`t know how to create the buffers to
> > receive and to send data

>
> It all depends on what you plan on doing with the buffer. If you plan on
> filling it, then passing it to something else, a std::string should be fine.
> If you need to buffer messages by some code or something, maybe a
> std::vector<std::string>.


There is also std::queue, and std::streambuf, the first can be used
direct as a fifo container or as an interface example for say a fixed
size buffer using an array. The second may provide a base class for
the interface for a buffer.


I think Boost.Asio covers this sort of ground, so may be worth
investigating too:

http://tinyurl.com/yq3cc2

That said I have never had much dealings with any of the above...


regards
Andy Little


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Modeling switches without bi-directional buffers easwarsr@gmail.com VHDL 2 07-30-2005 11:40 PM
Delay with buffers ratep2001 VHDL 3 02-28-2005 09:56 PM
Question about Header Buffers root Cisco 0 10-12-2004 05:14 PM
Designing MUX with tri sate buffers in xilinx virtex II FPGA Oleg VHDL 4 04-06-2004 02:55 PM
Ingress buffers on 4000 series oversubscribed gigabit line cards Peter Yardley Cisco 2 11-14-2003 11:41 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57