All of lore.kernel.org
 help / color / mirror / Atom feed
* Very Urgent !! (2'nd Post)  Not able to recieve messages using sock_recvmsg()
@ 2004-01-12 11:11 VIJAYABHASKAR
  0 siblings, 0 replies; 2+ messages in thread
From: VIJAYABHASKAR @ 2004-01-12 11:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: Atul V Kulkarni, Arvind Kumar

-HI All,
-I am not able to recieve messages using sock_recvmsg()
-Server running on TCP port in kernel space and client is in  user space.
Client is sending the messages and server recieving them and no error
observed while recieving.
But i couldn't able to get the messages
This is the code i am using
 msg.msg_name = NULL;
msg.msg_namelen = 0;
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
msg.msg_control = NULL;
msg.msg_controllen = 0;
msg.msg_flags = 0
len = 0
 len = sock_recvmsg(newsock, &msg, (size_t)buf, 0)
printk( KERN_ALERT "recieved message is %s",buf)
But not printing the content of buffer.
Any help in this regard is highly appreciated
Thanks
Bhaskar


^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: Very Urgent !! (2'nd Post)  Not able to recieve messages using sock_recvmsg()
       [not found] <200401121736.09720.krishnakumar@naturesoft.net>
@ 2004-01-12 12:21 ` VIJAYABHASKAR
  0 siblings, 0 replies; 2+ messages in thread
From: VIJAYABHASKAR @ 2004-01-12 12:21 UTC (permalink / raw)
  To: krishnakumar; +Cc: linux-kernel

HI Krishna,
It is not printing the length,stucking in that statement it self.
I am sending about 10 characters from the client
client using the following code to send:
 char buf[10]="123456789";

        iov.iov_base=(void *)buf;
        iov.iov_len=(size_t)10;

        msg.msg_name=NULL;
        msg.msg_namelen=0; //sizeof(server);
        msg.msg_iov=&iov;
        msg.msg_iovlen=1;
        msg.msg_control=NULL;
        msg.msg_controllen=0;
        msg.msg_flags = 0;

 for (i=0;i<NUM_PACKAGE;i++)
                {
                 //strcpy(buf,"1");

                 oldfs = get_fs(); set_fs(KERNEL_DS);
                 error = sock_sendmsg(Socket[0], &msg,10);

                /* len = sock_recvmsg(Socket[0], &msg, (size_t)buf, 0);
                 set_fs(oldfs);

                 if (len<0)
                        printk(KERN_ALERT "ERRO receive ########\n");*/

                 if (error<0)
                        printk(KERN_ALERT "Erro send msg ERRO = %d
buf=%s\n",error,buf);
}

Server side using the following code:

iov.iov_base = (void *)buf;
        iov.iov_len = (size_t)10;

        msg.msg_name = NULL;
        msg.msg_namelen = 0;
        msg.msg_iov = &iov;
        msg.msg_iovlen = 1;
        msg.msg_control = NULL;
        msg.msg_controllen = 0;
        msg.msg_flags = 0;

        len = 0;
for (i=0;i<1;i++)
                {
                 oldfs = get_fs(); set_fs(KERNEL_DS);
                 printk(KERN_ALERT " before recieving message \n");
                 len = sock_recvmsg(newsock, &msg,10, 0);
                 printk( KERN_ALERT " Recieved message length is %d
\n",len);
                 printk( KERN_ALERT "recieved message is %s",buf);

}

Am i doing wrong??
Please clarify...
Thanks
Bhaskar
-----Original Message-----
From: Krishnakumar. R [mailto:krishnakumar@naturesoft.net]
Sent: Monday, January 12, 2004 5:36 PM
To: vijayabhaskar@tataelxsi.co.in
Subject: Re: Very Urgent !! (2'nd Post) Not able to recieve messages
using sock_recvmsg()


Hello Bhaskar,

What is the return value you are getting.
ie. Did you try printing the return value
and see what is being printed.

Some thing like the following.

>  len = sock_recvmsg(newsock, &msg, (size_t)buf, 0)

printk("Return value = %d \n", len);

> printk( KERN_ALERT "recieved message is %s",buf)


Hope that helps,
Regards,
KK.

PS: Are you an alumni of GEC TCR ?



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-01-12 12:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-12 11:11 Very Urgent !! (2'nd Post) Not able to recieve messages using sock_recvmsg() VIJAYABHASKAR
     [not found] <200401121736.09720.krishnakumar@naturesoft.net>
2004-01-12 12:21 ` VIJAYABHASKAR

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.