易截截图软件、单文件、免安装、纯绿色、仅160KB

请教linux组播问题。 - Linux/Unix社区 / 程序开发区

我的板子用嵌入式linux系统发送组播包给我PC虚拟机的linux,虚拟机的linux可以接收到,但是同样的程序,用虚拟机的linux发送,嵌入式linux却接收不到,具体表现为阻塞在recvfrom函数。
大致已经可以排除的问题:
1、网络、交换机等问题,2台设备之间直接用网线相连,不经过任何中间设备。
2、嵌入式linux内核问题,内核编译时我已经选上支持multicast,而且嵌入式linux能发出组播包说明内核起码在一定程度上肯定支持组播了,但不知道是否还有其他选项需要选?

以下是程序:

接收端程序
-----------------
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/time.h>
#include <signal.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <memory.h>

#define PORT 9000
#define MultiAddr "224.0.1.1"
int main(void)
{
  struct ip_mreq command;
  int loop = 1;
int ttl=128;
  int iter = 0;
  int sin_len;
  char message[256];
  int socket_descriptor;
  struct sockaddr_in sin;


  memset(&sin, 0, sizeof(sin));
  sin.sin_family = AF_INET;

  sin.sin_port = htons(PORT);
  if((socket_descriptor = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
  {
  perror("socket");
 


相关问答:

linux环境下gethostbyname函数问题 - C/C++ / C语言

写了个测试程序如下
   
  struct hostent *hp; 
char AlarmDevIP[20];  
  int x2;

hp = gethostbyname("www.google.com");
if (hp)
{ ......

是选win2008还是suse linux、redhat、centos,犹豫中

引用内容vsking 2009-12-25 22:56:52
现在是win2008和iis8的时代了,不要还停留在iis5时代,win2008被评为十佳操作系统之首不是偶然的,你要是..
我的问题是:
最近想买个服务器,看了dell上的系统定制选择,一些 ......

[HJ_34] 在HTML网页下,用JS 打开LINUX下的记事本

如题,在WINDOWS底下的CODE会,但在LINUX下不知道如何实现,JS的代码应该是不一样的。 求教。

分不够再加。

http://topic.csdn.net/u/20100113/08/17ba1e71-4c33-43f6-91a5-0e031c86e5ed.html
linux ......

linux 权限设置的问题 - Web 开发 / 应用服务器

在ubuntu上搭建了服务器,根目录为/var/www,使用php脚本在/var/www/html文件夹下生成了文件夹和文件,生成的格式是/var/www/html/123456/sss.html,生成后查看html文件夹的权限是www-data,我执行php的删除脚本的时 ......

如何开始学习 Linux 内核 [转] - C/C++ / 非技术区

> Message: 1
> Date: Sat, 24 Apr 2010 11:31:02 +1000
> from: Crossfire <xfire@xware.cx>
> Subject: Re: [coders] New to Kernel programming and device drivers
> To: coders@slug. ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号