您尚未登录。

#1 2012-10-30 20:49:27

jouyouyun
会员
注册时间: 2011-10-10
帖子: 268

sendto error: Invalid argument(已解决)

sendto()函数错误,不知道哪个参数错了。详细代码见:https://github.com/jouyouyun/update/blo … li_test2.c
另外在 https://github.com/jouyouyun/update/tree/master/test1 的头文件中没有定义 first_flag,程序没有错误。

最近编辑记录 jouyouyun (2012-10-31 18:36:17)

离线

#2 2012-10-30 21:59:06

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,430
个人网站

Re: sendto error: Invalid argument(已解决)

代码好乱 :-(
那个,geakit 的 CDN 挂了。换个地方贴下?

离线

#3 2012-10-30 22:32:38

jouyouyun
会员
注册时间: 2011-10-10
帖子: 268

Re: sendto error: Invalid argument(已解决)

离线

#4 2012-10-30 23:01:15

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,430
个人网站

Re: sendto error: Invalid argument(已解决)

没有 Makefile 啊喵……

「tar: jouyouyun-update-8f0b71f:时间戳 2012-10-31 04:43:00 是未来的 20581.398238456 秒之后」喵……

离线

#5 2012-10-31 11:20:02

jouyouyun
会员
注册时间: 2011-10-10
帖子: 268

Re: sendto error: Invalid argument(已解决)

百合仙子 说:

没有 Makefile 啊喵……

「tar: jouyouyun-update-8f0b71f:时间戳 2012-10-31 04:43:00 是未来的 20581.398238456 秒之后」喵……

服务端:

gcc -Wall -g ser_test2.c common.c -o ser

客户端:

gcc -Wall -g cli_test2.c common.c -o cli

对于生成两个目标的 Makefile 表示不会写,只会写一些简单的。

离线

#6 2012-10-31 12:58:13

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,430
个人网站

Re: sendto error: Invalid argument(已解决)

「EINVAL The dest_len argument is not a valid length for the address family.」
你给 sendto 传的地址长度是 0(没有设置)。

另外,Linux 不建议使用 bzero,「CONFORMING TO 4.3BSD.  This function is deprecated (marked as LEGACY in POSIX.1-2001): use memset(3) in new programs.  POSIX.1-2008 removes the specification of bzero().」
Windows 上没有这个函数。

离线

#7 2012-10-31 17:44:38

jouyouyun
会员
注册时间: 2011-10-10
帖子: 268

Re: sendto error: Invalid argument(已解决)

百合仙子 说:

「EINVAL The dest_len argument is not a valid length for the address family.」
你给 sendto 传的地址长度是 0(没有设置)。

另外,Linux 不建议使用 bzero,「CONFORMING TO 4.3BSD.  This function is deprecated (marked as LEGACY in POSIX.1-2001): use memset(3) in new programs.  POSIX.1-2008 removes the specification of bzero().」
Windows 上没有这个函数。

噢,明白了, finfo.addr_len 变量没有初始化。

离线

页脚