mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "VIJAYABHASKAR" <vijayabhaskar@tataelxsi.co.in>
To: <krishnakumar@naturesoft.net>
Cc: <linux-kernel@vger.kernel.org>
Subject: RE: Very Urgent !! (2'nd Post)  Not able to recieve messages using sock_recvmsg()
Date: Mon, 12 Jan 2004 17:51:22 +0530	[thread overview]
Message-ID: <004101c3d906$97b26d30$501e010a@telxsi.com> (raw)
In-Reply-To: <200401121736.09720.krishnakumar@naturesoft.net>

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 ?



       reply	other threads:[~2004-01-12 12:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200401121736.09720.krishnakumar@naturesoft.net>
2004-01-12 12:21 ` VIJAYABHASKAR [this message]
2004-01-12 11:11 VIJAYABHASKAR

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='004101c3d906$97b26d30$501e010a@telxsi.com' \
    --to=vijayabhaskar@tataelxsi.co.in \
    --cc=krishnakumar@naturesoft.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome