@lupine hey can you help me again? server works fine with telnet but for purposes of this assignment i need a client to accompany it
https://gist.github.com/Lana-chan/182b76032605a70a2c8b2acc508d3962
i receive from the server fine and it prints, but typing things seems to do absolutely nothing, like fd_isset(0) just never triggers
@lupine i already tried many different approaches and the problem in all of them seems to be that whatever is inside if(FD_ISSET(0, &socks)) just never ever ever runs
select just isn't seeing stdin at all
@squirrel I ran it and got:
```
lupine@t470p:~$ ./main localhost
connect(): Success
fgets():
hi
```
so it does run sometimes. You're mixing select with non-blocking ops though, which is always going to be painful, and probable unneeded for a client
2 threads, one reads from the socket and writes to stdout whenever it hits a \n; thew other runs fgets() in a loop and writes to the socket. All is well.
Clients are much easier than servers.
@lupine ok so i rewrote it to this and it works better but incoming stuff from the server still gets mangled sometimes (first line is ok, subsequent prompts get broken into 2 lines i think because of the stdin newlines, and i need to press enter to receive lines from other clients?)
https://gist.github.com/Lana-chan/182b76032605a70a2c8b2acc508d3962
@lupine (getting more than one char from server at a time makes it worse)
@lupine i kept poking at it and got it working :) thank you
@squirrel not certain offhand. I'd probably tigger a separate thread for fgets(), put its input into a buffer, and feed that to the server in the same loop as reading from the same via the writefds arg to select.
libev makes all this so much kinder.