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@axway.com
http://www.axway.com

 

 

P Pensez à l’environnement avant d’imprimer.