In my code for telnet client, I want to echo always. So I will send wont echo to the server.
That's wrong for a start. If you will echo, you need to send DONT echo. WILL/WONT is a response, not a request. And in any case if you want to echo why would you say you won't? It doesn't make sense.
Linux machines obey the command
It's not a command, it's a request. The server is free to agree or disagree. If the server disagrees it will send you the opposite WILL/WONT response. If it agrees it will send you an agreeing WILL/WONT response.
but windows machines suppress the wont command and send do echo command instead [confirmed from wireshark and GDB].
That's what you want! You want to echo, and it is telling you to echo. You got it wrong in the protocol but the end result is exactly as you wished.
Note: to avoid loops, if the peer had already sent a WILL/WONT response before you sent your DO/DONT, it won't send you the same message after it receives yours, if it now agrees with you. This can happen when either side initially disagrees. Again see the Telnet RFCs. You particularly need to read the one about how to implement this feature ('Q method').