开发者

HELP TCP Server in C cannot save in MYSQL !

开发者 https://www.devze.com 2023-01-16 22:03 出处:网络
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 probl

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消