[Click] receiving data into a buffer

sam barker sam.barker0 at gmail.com
Wed Jan 30 07:27:24 EST 2008


Hi Beyers,

Basically,I will be sending the data [say 128 bits] through a socket
routine[ outside of click.

So in my config file can if I have

Socket(TCP, 127.0.0.1,1322)->[0]my_element

and in my_element.cc file if I have


void myelement::push(int port, Packet *p)
{
.....
  if (port == 0) {
    // First input port
    method0(p);
  } else if (port == 1) {
    // Second input port
    method1(p);
  }
....
}

void myelement::method0(Packet *p)
{
//here if I say
    char *x=(char *)p->data()

}
then x will be the pointer to 128 bits which is received?


Also if I want to send 128 bit through click to a program outside click
can I write my own socket element just to send ?

Cheers,
Sam

On Jan 30, 2008 9:38 PM, Beyers Cronje <bcronje at gmail.com> wrote:

> Socket element stores the data in a Click Packet. Read-only access to the
> data in your element is through Packet::data(), write access to the data
> through WritablePacket::data(). To get a WritablePacket you can call
> Packet::uniqueify()
>
> On Jan 30, 2008 5:27 AM, sam barker <sam.barker0 at gmail.com> wrote:
>
> > Hi,
> > How can I  receive the incoming data from a socket into a buffer.
> > How can I specify in the config file
> > Socket(TCP, 127.0.0.1,1322) ->..?
> > For example if I send 128 bits to click,how can I store it in a buf[like
> > char type ] so that I can use it with an element;
> >
> > Cheers,
> > Sam
> > _______________________________________________
> > click mailing list
> > click at amsterdam.lcs.mit.edu
> > https://amsterdam.lcs.mit.edu/mailman/listinfo/click
> >
>
>


More information about the click mailing list