Emanuele Clerici wrote:
> 2006/11/21, Jan Kiszka <[EMAIL PROTECTED]>:
>>
>> Emanuele Clerici wrote:
>> > Hi,
>> > I've tried with this code
>> >
>> > "server"
>> > ----------------------------------
>> > if (argc == 2) {
>> > local_addr.sin_family = AF_INET;
>> > local_addr.sin_addr.s_addr = INADDR_ANY;
>> > local_addr.sin_port = htons(atoi(argv[1]));
>> > } else {
>> > fprintf(stderr,
>> > "Usage: "
>> > "%s <local-port>\n",
>> > argv[0]);
>> > exit(1);
>> > }
>> > mlockall(MCL_CURRENT|MCL_FUTURE);
>> > sockfd = socket(AF_INET, SOCK_DGRAM, 0);
>> > ret = bind(sockfd, (struct sockaddr *) &local_addr,sizeof(struct
>> > sockaddr_in));
>> > ret = recv(sockfd, &msg, sizeof(msg), 0);
>> > close(sockfd);
>> > printf("Received message: port %d owner %llu hard %d
>> > size=%d\n",msg.port,
>> > msg.owner,msg.hard,ret);
>> > ----------------------------------
>> > "client"
>> > ----------------------------------
>> > if (argc == 4) {
>> > local_addr.sin_family = AF_INET;
>> > local_addr.sin_addr.s_addr = INADDR_ANY;
>> > local_addr.sin_port = htons(atoi(argv[1]));
>> >
>> > server_addr.sin_family = AF_INET;
>> > inet_aton(argv[2], &server_addr.sin_addr);
>> > server_addr.sin_port = htons(atoi(argv[3]));
>> > } else {
>> > fprintf(stderr,
>> > "Usage: "
>> > "%s <local-port> "
>> > "<server-ip> <server-port>\n",
>> > argv[0]);
>> > exit(1);
>> > }
>> > mlockall(MCL_CURRENT|MCL_FUTURE);
>> > sockfd = rt_dev_socket(AF_INET, SOCK_DGRAM, 0);
>> > lxrtnettsk = rt_task_init(4800, 1, 0, 0);
>> > rt_make_hard_real_time();
>> > ret = rt_dev_bind(sockfd, (struct sockaddr *) &local_addr,
>> sizeof(struct
>> > sockaddr_in));
>> > rt_dev_connect(sockfd, (struct sockaddr *) &server_addr,
>> sizeof(struct
>> > sockaddr_in));
>> > rt_dev_send(sockfd, &msg, sizeof(msg), 0);
>> > rt_make_soft_real_time();
>> > rt_dev_close(sockfd);
>> > rt_task_delete(lxrtnettsk);
>> > ----------------------------------
>>
>> Are those extracts just copied from existing examples? Or did you change
>> anything?
>
>
> the client is an extract from existing examples, i've only changed the
> message sent, in the server I use linux socket function.
>
>>
>> > if I try with linux server & linux client it works, the same with rtnet
>> but
>> > this example doesn't work.
>>
>> What does "doesn't work" mean precisely? Describe the behaviour,
>> reported errors, whatever may help to understand your procedure and the
>> result. Consider describing it in a way that someone may actually be
>> able to reproduce it.
>
>
> i execute simpleserver on a free port and i run simpleclient on the other
> machine sending to this port. The client run's normally but the server
> wait's forever.
>
>> Is a misconfiguration problem of the two nodes, code's error or something
>> > else?
>>
>> Does rtping work from your RT host to the Linux system? What does
>> rtroute state?
>
>
> rtping work correctly
> and this is the route "cat"
> [EMAIL PROTECTED]:/home/# cat /proc/rtnet/ipv4/route
> Host routes allocated/total: 5/32
> Host hash table size: 64
> IP Router: no
> [EMAIL PROTECTED]:/home/# cat /proc/rtnet/ipv4/host_route
> Hash Destination HW Address Device
> 00 0.0.0.0 00:00:00:00:00:00 rtlo
> 01 192.168.3.1 00:00:00:00:00:00 rtlo
> 01 127.0.0.1 00:00:00:00:00:00 rtlo
> 02 192.168.3.2 00:48:54:6D:73:51 rteth0
> 3F 192.168.3.255 FF:FF:FF:FF:FF:FF rteth0
> Ok, that's so far a good sign. Now check if some message is actually sent from the client and what is received on the server. Use Wireshark/Ethereal for this, on the RTnet box via RTcap. Check if you are actually sending to / receiving on the right port. It's probably a trivial issue, but I can't see from here what is going wrong. Jan
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ RTnet-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/rtnet-users

