RE: Very Urgent !! (2'nd Post) Not able to recieve messages using sock_recvmsg()

From: VIJAYABHASKAR
Date: Mon Jan 12 2004 - 07:26:09 EST


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@xxxxxxxxxxxxxx]
Sent: Monday, January 12, 2004 5:36 PM
To: vijayabhaskar@xxxxxxxxxxxxxxx
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 ?


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/