Find Jobs
Hire Freelancers

C web service request in VM linux C not response

$30-250 USD

Closed
Posted almost 8 years ago

$30-250 USD

Paid on delivery
-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
Project ID: 10469242

About the project

6 proposals
Remote project
Active 8 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
6 freelancers are bidding on average $135 USD for this job
User Avatar
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 in 2 days
4.9 (159 reviews)
7.1
7.1
User Avatar
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 in 1 day
5.0 (12 reviews)
5.5
5.5
User Avatar
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 in 5 days
5.0 (24 reviews)
5.0
5.0
User Avatar
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 in 0 day
5.0 (3 reviews)
2.9
2.9

About the client

Flag of ISRAEL
Jerusalem, Israel
5.0
22
Member since Feb 17, 2011

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.