Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is there a way to get the data from the client into a char array ? #2

Open
denden4444 opened this issue Sep 1, 2018 · 1 comment
Open

Comments

@denden4444
Copy link

No description provided.

@denden4444
Copy link
Author

Hi Rudi

I was reading an earlier post of yours regarding WifiTelnetToSerial. Great catch on client.flush in that post too by the way ;-)
I am trying to modify this to be a simple TCP server on port 5252.
I am able to get the client to connect and send packets to this server but where I'm really struggling is to get the data that the client sends into a char array.
How do I change this (or what needs to be changed or set ) :
//get data from the telnet client and push it to the UART while(serverClients[i].available()) Serial.write(serverClients[i].read());
To be able to do that ?
I have these variables on the server :
//declare vars for receive char hDroid1[5] = { '\0' }; //4 or less digits/keys eg 1234 + NULL char pDroid1[3] = { '\0' }; //2 digits/keys eg 12 + NULL char ooDroid1[4] = { '\0' }; //3 or less digits/keys eg 123 + NULL char devDroid1[5] = { '\0' }; //4 or less digits/keys eg 9999 + NULL char allDroid[18] = { '\0' }; //total array count including NULL's
the data I receive from the client is 1234,12,123,999
and I would collect them from the allDroid array like this :
sscanf(allDroid, "%s,%s,%s,%s", &hDroid1, &pDroid1, &ooDroid1, &devDroid1);
which then would allow me to print them individually and or compare each one.

I hope you can advise/help
Kind regards
Den

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant