HELP TCP Server in C cannot save in MYSQL !
I'm developing a TCP Server in C language that can save data to mysql. The problem is "buf" cannot be save/insert into mysql. But "name" can be save/insert into mysql. Do u know what is the problem is? and how to fix that? I'm very glad if u can help me. below is the code.
to compile : gcc -o tcpecho $(my开发者_StackOverflow中文版sql_config --cflags) tcpecho.c $(mysql_config --libs)
It looks like the data from the first call to recv
is discarded without being inserted into the database. Also, you're passing the results of the later recv
calls to sprintf
without null-terminating them at the correct position for the number of bytes read
in that call.
精彩评论