Retrieving datas sent by host within the Guest

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

 

I' trying to read datas sent by my KVM host within the Guest.

Host send these datas trough a channel UNIX type , by using AF_UNIX socket stuff.

 

If i try to retrive the datas by using such type of thing in the Guest :

 

 

#define NAME "/dev/virtio-ports/agent"

 

sock = socket(AF_UNIX, SOCK_STREAM, 0);

12     if (sock < 0) {

13         perror("opening stream socket");

14         exit(1);

15     }

16     server.sun_family = AF_UNIX;

17     strcpy(server.sun_path, NAME);

18     if (bind(sock, (struct sockaddr *) &server, sizeof(struct sockaddr_un))) {

19         perror("binding stream socket");

20         exit(1);

21     }

 

 

I got  ""binding stream socket Address already in use"   when trying to bind the socket .

 

 

But If I use such kind of thing :

 

    fd = open("/dev/virtio-ports/agent", O_RDWR | O_NONBLOCK);

    ssize_t size = read(fd, &rcv_buffer, 100);

    if(size >0) printf("Read length(%d)  %s\n", size, rcv_buffer);

 

It works fine.

 

Is there any chance to be able to use socket stuff on Guest side or is there anything  I misunderstand?

 

Thanks for help.

 

 

J.P.

 

 

J.P. Ribeauville

 

P: +33.(0).1.47.17.20.49

.

Puteaux 3 Etage 5  Bureau 4

 

jpribeauville@xxxxxxxxx
http://www.axway.com

 

 

P Pensez à l’environnement avant d’imprimer.

 

 

_______________________________________________
libvirt-users mailing list
libvirt-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvirt-users

[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux