Find Jobs
Hire Freelancers

C web service request in VM linux C not response

$30-250 USD

已关闭
已发布大约 8 年前

$30-250 USD

货到付款
-1 down vote favorite I am working with a Linux based box which does video control. I need to add partial ONVIF support so that it can support multiple cameras with the same interface. I started writing code on my Windows development machine using virtual Linux environment, and succeeded in making some basic requests that got answered. However, I had to cheat a little. I didn't see a way with CURL to make the original WS-Discovery; to skip that part at the beginning, I listened to ONVIF manager with Wireshark, looked at the results of the WS-Discovery there, and took the results as the start of my program. Now I started to work backwards, and implement the WS-discovery. It seems pretty straightforward and I found several samples of C code. For example, I tried this: [login to view URL] and others. (Basically, open a socket, bind it to a port, set the options to allow broadcast, send it to a broadcast address, and see the results come in). However, no matter how I have written it, not only don't I get any responses - I cannot see the request being sent on Wireshark. Nothing happens. Even though all functions return successfully (opening socket, binding, option setting, sending, etc..) - nothing comes out. Now, ONVIF manager manages to send these packets - but from the Windows machine, not the Linux virtual machine. I thought that that might be the issue - but the other code I wrote which sends to specific addresses worked fine from the virtual machine (using the IP address which belongs to both the Windows host and the Linux VM). Here is one of the last samples I tested: /* * build instructions * * gcc -o bclient bclient.c * * Usage: * ./bclient <serverport> */ #include <stdio.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #define MAXBUF 65536 const char *data = "<s:Envelope xmlns:s=\"[login to view URL]\" xmlns:a=\"[login to view URL]\"><s:Header><a:Action s:mustUnderstand=\"1\">[login to view URL]</a:Action><a:MessageID>uuid:2c7722b3-ae7d-475c-b89d-0d1885784b9f</a:MessageID><a:ReplyTo><a:Address>[login to view URL]</a:Address></a:ReplyTo><a:To s:mustUnderstand=\"1\">urn:schemas-xmlsoap-org:ws:2005:04:discovery</a:To></s:Header><s:Body><Probe xmlns=\"[login to view URL]\"><d:Types xmlns:d=\"[login to view URL]\" xmlns:dp0=\"[login to view URL]\">dp0:NetworkVideoTransmitter</d:Types></Probe></s:Body></s:Envelope>"; int main(void) { int sock, status, buflen, sinlen; char buffer[MAXBUF]; struct sockaddr_in sock_in; int yes = 1; sinlen = sizeof(struct sockaddr_in); memset(&sock_in, 0, sinlen); buflen = MAXBUF; sock = socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP); sock_in.sin_addr.s_addr = htonl(INADDR_ANY); sock_in.sin_port = htons(0); sock_in.sin_family = PF_INET; status = bind(sock, (struct sockaddr *)&sock_in, sinlen); printf("Bind Status = %d\n", status); status = setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &yes, sizeof(int) ); printf("Setsockopt Status = %d\n", status); sock_in.sin_addr.s_addr=inet_addr("[login to view URL]"); sock_in.sin_port = 3207; /* port number */ sock_in.sin_family = PF_INET; sprintf(buffer,"%s", data); buflen = strlen(buffer); status = sendto(sock, buffer, buflen, 0, (struct sockaddr *)&sock_in, sinlen); printf("sendto Status = %d\n", status); shutdown(sock, 2); close(sock); That runs, each function reports success - and nothing is sent. what I am missing? Need solution asap
项目 ID: 10469242

关于此项目

6提案
远程项目
活跃8 年前

想赚点钱吗?

在Freelancer上竞价的好处

设定您的预算和时间范围
为您的工作获得报酬
简要概述您的提案
免费注册和竞标工作
6威客以平均价$135 USD来参与此工作竞价
用户头像
I am very proficient in c and c++. I have 16 years c++ developing experience now, and have worked for more than 6 years. My work is online game developing, and mainly focus on client side, using c++ under windows environment. I used c++ to make many great projects, for example, I made the tools which can convert java files into c++ scripts, of course garbage collection included, this job is very similar to a compiler, and is very complex. I also made our own mobile game using c++, I can show you the demo of client, if you like. I am very proficient in java also. I have a very good review on Freelancer.com, I never miss a project once I accept the job, you can check my review. Trust me, please let expert help you.
$150 USD 在2天之内
4.9 (159条评论)
7.1
7.1
用户头像
Hi & shalom, Can you state the virtual software you are using? how is configure the network part in the virtual software. And check the firewall config in your windows!!! Best regards, David 30+ years C/Unix-HP-UX-Solaris-AIX/Linux programmer, performance +10 years embedded Linux (openwrt/raspberry/odroid) & Arduino. Oracle OVM admin Unix/Linux Kernel support & dev Python dev. PHP dev. Uni* scripting TCP/IP dev. mysql/mariadb/sql adm&dev NFS (admin & rpc programming) XML
$55 USD 在1天之内
5.0 (12条评论)
5.5
5.5
用户头像
Hello, I can do this. I have been programming in c, c++ and Linux for last 8+ years. I have developed many complex software's involving System Programming, Network Programming , Socket Programming,, Shared Memory, IPC, Queue etc .. Check my profile: https://www.freelancer.com/u/rajeshpal007.html -Rajesh
$315 USD 在5天之内
5.0 (24条评论)
5.0
5.0
用户头像
I am sure I can help you with this. Please let me know if you'r interested so we can discuss the details and the help you need.
$100 USD 在0天之内
5.0 (3条评论)
2.9
2.9

关于客户

ISRAEL的国旗
Jerusalem, Israel
5.0
22
会员自2月 17, 2011起

客户认证

谢谢!我们已通过电子邮件向您发送了索取免费积分的链接。
发送电子邮件时出现问题。请再试一次。
已注册用户 发布工作总数
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
加载预览
授予地理位置权限。
您的登录会话已过期而且您已经登出,请再次登录。