lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Sending out TCP-Data as integer type


From: Bill Auerbach
Subject: Re: [lwip-users] Sending out TCP-Data as integer type
Date: Wed, 5 Dec 2012 16:11:33 -0500

 

 

From: address@hidden [mailto:address@hidden On Behalf Of Firedog I.
Sent: Wednesday, December 05, 2012 9:38 AM
To: address@hidden
Subject: [lwip-users] Sending out TCP-Data as integer type

 

Hi everyone,

 

I got a little problem over here. I can send simple TCP-Data like string and char, but I can’t send data as integer type. I’m using lwIP v1.36 with RAW API.

 

Example:

 

/*Connection to Client established…*/

int data = "" //or int data = "">

tcp_write(pcb, data, 1, 1);

 

tcp_write 2nd param is a void * arg – a pointer.  So you want:

 

tcp_write(pcb,&data,1,1);

 

but then using an int could be a problem depending on the platform.  Always best to use bytes (chars).

 

char data = "">

tcp_write(pcb,&data,1,1);

 

should do it.  If you were to change data to an array of chars, then:

 

char data[] = { 0xFF };

tcp_write(pcb,&data,sizeof data,1);

 

is better still. And you can add bytes to the initializer for data[] without changing any other code.

 

Bill

 

 

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]