sockets - is there a working vmci example? -


i need working vmci socket example udp does, without networking. there many code fragments in vmci_sockets.h code, not full working template expand on.

i believe server should follows:

#include "vmci_sockets.h" #define bufsize 2048  int main() {   int afvmci = vmcisock_getafvalue();   if ((sockfd_dgram = socket(afvmci, sock_dgram, 0)) == -1) {     perror("socket");     goto exit;   }    struct sockaddr_vm my_addr = {0};   my_addr.svm_family = afvmci;   my_addr.svm_cid = vmaddr_cid_any;   my_addr.svm_port = vmaddr_port_any;   if (bind(sockfd, (struct sockaddr *) &my_addr, sizeof my_addr) == -1) {     perror("bind");     goto close;   }    if (getsockname(sockfd, (struct sockaddr *) &my_addr, &svm_size) == -1) {     perror("getsockname");     goto close;   }    if ((numbytes = recvfrom(sockfd, buf, sizeof buf, 0,                (struct sockaddr *) &their_addr, &svm_size)) == -1) {     perror("recvfrom");     goto close;   }   close:   return close(sockfd); } 

and client

#include <stdio.h> #include <string.h>  #include "vmci_sockets.h" #define bufsize 128   int main() {   int afvmci = vmcisock_getafvalue();    int fd;   struct sockaddr_vm addr;   if ((fd = socket(afvmci, sock_dgram, 0)) == -1) {     perror("socket");     return 1;   }    addr.svm_family = afvmci;   addr.svm_cid = vmaddr_cid_any;   addr.svm_port = vmaddr_port_any;   bind(fd, (struct sockaddr *) &addr, sizeof addr);    struct sockaddr_vm serveraddr;   socklen_t svm_size = sizeof serveraddr;    {     int numbytes; char buf[bufsize]; bzero(buf, bufsize);     strcpy(buf, "hello there\n");     if ((numbytes = sendto(fd, buf, bufsize, 0,                (const struct sockaddr *) &serveraddr, svm_size)) == -1) {       perror("sendto error");       goto close;     }   }   close:   close(fd);   vmcisock_releaseafvaluefd(fd);   return 0; } 

however, it's not working. there not documentation, e.g., how troubleshoot. there not information whether 1 can try both server , client within same virtual machine debugging purposes.

i tried post vmware board, sent email support, no 1 seems have working example. because not standard socketry, though similar socketry, , not followable.

anyone have working example?

vmci apparently not supported vmplayer or vmware fusion. vmware support people told me:

i have been checking internally our development team regarding request , incidentally generate interest if situation failing vsphere. final comment have never meant officially support vmware fusion , dependencies on internal references only.

unfortunately, not have such vmci example can shared publicly when comes vmware fusion.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -