* Maximum no of bytes Ethernet can transfer at a time ??
@ 2011-04-27 12:11 Ajit
2011-04-27 12:21 ` Eric Dumazet
2011-04-27 13:01 ` Neil Horman
0 siblings, 2 replies; 12+ messages in thread
From: Ajit @ 2011-04-27 12:11 UTC (permalink / raw)
To: netdev
Guys,
I have developed a code which uses raw sockets to transfer files. My code skips
all the upper layer protocols,I have designed a small protocol of my own.
Now to problem is, whenever I transfer a large file it creates a problem. If
transfer a file of suppose 100kb or more, only 97.9 Kb is received, unlike in
the case of files smaller that 97.9.
What can be the problem ?? Does continuously sending and receiving of frames
creates a problem ??
If any one is interested I can give you my code..
Thank you.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Maximum no of bytes Ethernet can transfer at a time ??
2011-04-27 12:11 Maximum no of bytes Ethernet can transfer at a time ?? Ajit
@ 2011-04-27 12:21 ` Eric Dumazet
2011-04-27 12:27 ` Ajit
2011-04-27 13:01 ` Neil Horman
1 sibling, 1 reply; 12+ messages in thread
From: Eric Dumazet @ 2011-04-27 12:21 UTC (permalink / raw)
To: Ajit; +Cc: netdev
Le mercredi 27 avril 2011 à 12:11 +0000, Ajit a écrit :
> Guys,
>
> I have developed a code which uses raw sockets to transfer files. My code skips
> all the upper layer protocols,I have designed a small protocol of my own.
>
> Now to problem is, whenever I transfer a large file it creates a problem. If
> transfer a file of suppose 100kb or more, only 97.9 Kb is received, unlike in
> the case of files smaller that 97.9.
>
> What can be the problem ?? Does continuously sending and receiving of frames
> creates a problem ??
Sure, check your syscall returns values, and search for SO_RCVBUF &
SO_SNDBUF (man 7 socket)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Maximum no of bytes Ethernet can transfer at a time ??
2011-04-27 12:21 ` Eric Dumazet
@ 2011-04-27 12:27 ` Ajit
2011-04-28 6:36 ` Ajit
0 siblings, 1 reply; 12+ messages in thread
From: Ajit @ 2011-04-27 12:27 UTC (permalink / raw)
To: netdev
Eric Dumazet <eric.dumazet <at> gmail.com> writes:
> Sure, check your syscall returns values, and search for SO_RCVBUF &
> SO_SNDBUF (man 7 socket)
>
> --
okies..I dont know exactly how to use those but I will google and try it..
will post my result after some time.
Thank you
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Maximum no of bytes Ethernet can transfer at a time ??
2011-04-27 12:27 ` Ajit
@ 2011-04-28 6:36 ` Ajit
2011-04-28 6:40 ` Eric Dumazet
2011-04-28 21:24 ` Rick Jones
0 siblings, 2 replies; 12+ messages in thread
From: Ajit @ 2011-04-28 6:36 UTC (permalink / raw)
To: netdev
Ajit <ajitsa_bes <at> yahoo.com> writes:
>
> Eric Dumazet <eric.dumazet <at> gmail.com> writes:
>
> > Sure, check your syscall returns values, and search for SO_RCVBUF &
> > SO_SNDBUF (man 7 socket)
> >
> > --
>
> okies..I dont know exactly how to use those but I will google and try it..
> will post my result after some time.
>
> Thank you
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo <at> vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
hi sir,
I tried out something as you said.
I introduces this lines in my code,
getsockopt(s,SOL_SOCKET,SO_RCVBUF,&optval,&optlen);
printf("The value of optlen is %d\n",optlen);
It always displays 4.
I really have no idea about it. Do I need to use setsockopt options in my
receiver code ??
If so, what difference will it make ??
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: Maximum no of bytes Ethernet can transfer at a time ??
2011-04-28 6:36 ` Ajit
@ 2011-04-28 6:40 ` Eric Dumazet
2011-04-28 21:24 ` Rick Jones
1 sibling, 0 replies; 12+ messages in thread
From: Eric Dumazet @ 2011-04-28 6:40 UTC (permalink / raw)
To: Ajit; +Cc: netdev
Le jeudi 28 avril 2011 à 06:36 +0000, Ajit a écrit :
> Ajit <ajitsa_bes <at> yahoo.com> writes:
>
> >
> > Eric Dumazet <eric.dumazet <at> gmail.com> writes:
> >
> > > Sure, check your syscall returns values, and search for SO_RCVBUF &
> > > SO_SNDBUF (man 7 socket)
> > >
> > > --
> >
> > okies..I dont know exactly how to use those but I will google and try it..
> > will post my result after some time.
> >
> > Thank you
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe netdev" in
> > the body of a message to majordomo <at> vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> >
> >
>
>
> hi sir,
> I tried out something as you said.
>
> I introduces this lines in my code,
>
> getsockopt(s,SOL_SOCKET,SO_RCVBUF,&optval,&optlen);
> printf("The value of optlen is %d\n",optlen);
>
Oh well, netdev is really not the place to discussion like that.
int optval;
socklen_t optlen = sizeof(optval);
getsockopt(s,SOL_SOCKET,SO_RCVBUF, &optval, &optlen);
printf("The value of optval is %d\n", optval);
> It always displays 4.
>
> I really have no idea about it. Do I need to use setsockopt options in my
> receiver code ??
> If so, what difference will it make ??
It makes sure your socket can really receive enough messages (or kernel
drops them)
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: Maximum no of bytes Ethernet can transfer at a time ??
2011-04-28 6:36 ` Ajit
2011-04-28 6:40 ` Eric Dumazet
@ 2011-04-28 21:24 ` Rick Jones
1 sibling, 0 replies; 12+ messages in thread
From: Rick Jones @ 2011-04-28 21:24 UTC (permalink / raw)
To: Ajit; +Cc: netdev
> I tried out something as you said.
>
> I introduces this lines in my code,
>
> getsockopt(s,SOL_SOCKET,SO_RCVBUF,&optval,&optlen);
> printf("The value of optlen is %d\n",optlen);
>
> It always displays 4.
Because the length of the optval is always 4 when retrieving the
SO_RCVBUF setting. You want to print the value of optval.
rick jones
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Maximum no of bytes Ethernet can transfer at a time ??
2011-04-27 12:11 Maximum no of bytes Ethernet can transfer at a time ?? Ajit
2011-04-27 12:21 ` Eric Dumazet
@ 2011-04-27 13:01 ` Neil Horman
2011-04-28 5:49 ` Ajit
1 sibling, 1 reply; 12+ messages in thread
From: Neil Horman @ 2011-04-27 13:01 UTC (permalink / raw)
To: Ajit; +Cc: netdev
On Wed, Apr 27, 2011 at 12:11:35PM +0000, Ajit wrote:
> Guys,
>
> I have developed a code which uses raw sockets to transfer files. My code skips
> all the upper layer protocols,I have designed a small protocol of my own.
>
> Now to problem is, whenever I transfer a large file it creates a problem. If
> transfer a file of suppose 100kb or more, only 97.9 Kb is received, unlike in
> the case of files smaller that 97.9.
>
> What can be the problem ?? Does continuously sending and receiving of frames
> creates a problem ??
>
> If any one is interested I can give you my code..
>
> Thank you.
>
What transport layer are you using (UDP/TCP/SCTP/etc)? Does a simmilar transfer
work if you use an actual TCP/UDP socket, rather than your raw one? If you're
consistently getting 97.9k transferred, that almost sounds like some sort of
firewall type connection limitation. Take a TCPDump from the peer to get a
better idea of whats going on when the connection fails
Neil
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Maximum no of bytes Ethernet can transfer at a time ??
2011-04-27 13:01 ` Neil Horman
@ 2011-04-28 5:49 ` Ajit
2011-04-28 11:06 ` Neil Horman
0 siblings, 1 reply; 12+ messages in thread
From: Ajit @ 2011-04-28 5:49 UTC (permalink / raw)
To: netdev
Neil Horman <nhorman <at> tuxdriver.com> writes:
hii Neil,
I am not using the transport layer neither the Network layer. I have written a
small protocol which work of a LAN without a router. So ideally there is no need
of the network layer (I am using physical address for the transfer).
I have defined a filed called as "offset" and another one called as "id".
Whenever you send a file, it is divided into various frames depending upon the
size of the file and send with the same "id" and an offset incremented by 1.
As you said the firewall issues. I don't think that is the problem because I am
sending the file to myself, but , on eth0 rather than lo, because send on lo
wont give the expected results.
If you still want some explanation then please ask me.
Thank you.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Maximum no of bytes Ethernet can transfer at a time ??
2011-04-28 5:49 ` Ajit
@ 2011-04-28 11:06 ` Neil Horman
2011-04-29 8:39 ` Ajit
2011-04-29 8:53 ` Ajit
0 siblings, 2 replies; 12+ messages in thread
From: Neil Horman @ 2011-04-28 11:06 UTC (permalink / raw)
To: Ajit; +Cc: netdev
On Thu, Apr 28, 2011 at 05:49:23AM +0000, Ajit wrote:
> Neil Horman <nhorman <at> tuxdriver.com> writes:
>
>
> hii Neil,
>
> I am not using the transport layer neither the Network layer. I have written a
> small protocol which work of a LAN without a router. So ideally there is no need
> of the network layer (I am using physical address for the transfer).
>
You may not be using the trasport layer, but you are still using IP, if you're
using SOCK_RAW sockets as you indicated.
> I have defined a filed called as "offset" and another one called as "id".
> Whenever you send a file, it is divided into various frames depending upon the
> size of the file and send with the same "id" and an offset incremented by 1.
>
> As you said the firewall issues. I don't think that is the problem because I am
> sending the file to myself, but , on eth0 rather than lo, because send on lo
> wont give the expected results.
>
Why not?
> If you still want some explanation then please ask me.
>
Can you just post a link to the code?
Neil
> Thank you.
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Maximum no of bytes Ethernet can transfer at a time ??
2011-04-28 11:06 ` Neil Horman
@ 2011-04-29 8:39 ` Ajit
2011-04-29 19:06 ` Neil Horman
2011-04-29 8:53 ` Ajit
1 sibling, 1 reply; 12+ messages in thread
From: Ajit @ 2011-04-29 8:39 UTC (permalink / raw)
To: netdev
Neil Horman <nhorman <at> tuxdriver.com> writes:
> >
> Can you just post a link to the code?
> Neil
>
> > Thank you.
> >
> >
here are the links to the code..
sender code : http://pastebin.com/se17Xn96
The command line arguments are like ./pgm_name eth0 /root/abc
where abc is the file name.
receiver code : http://pastebin.com/AKiUWzwR
just run it.
In the receiver code I have assigned offset to buffer[15], it was just for
debugging purpose. Actually offset must have 16 bits of buffer[15] and
buffer[16], but for files of around 100kb-200kb it will easily work..no need to
modify.
Thank you.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Maximum no of bytes Ethernet can transfer at a time ??
2011-04-29 8:39 ` Ajit
@ 2011-04-29 19:06 ` Neil Horman
0 siblings, 0 replies; 12+ messages in thread
From: Neil Horman @ 2011-04-29 19:06 UTC (permalink / raw)
To: Ajit; +Cc: netdev
On Fri, Apr 29, 2011 at 08:39:31AM +0000, Ajit wrote:
> Neil Horman <nhorman <at> tuxdriver.com> writes:
>
>
> > >
> > Can you just post a link to the code?
> > Neil
> >
> > > Thank you.
> > >
> > >
>
> here are the links to the code..
>
> sender code : http://pastebin.com/se17Xn96
>
> The command line arguments are like ./pgm_name eth0 /root/abc
>
> where abc is the file name.
>
> receiver code : http://pastebin.com/AKiUWzwR
>
> just run it.
>
> In the receiver code I have assigned offset to buffer[15], it was just for
> debugging purpose. Actually offset must have 16 bits of buffer[15] and
> buffer[16], but for files of around 100kb-200kb it will easily work..no need to
> modify.
>
> Thank you.
>
Well, just looking at it, I presume you're getting an error on send when you
send over your raw socket. If so, whats the error you're getting? If you're
not getting an error, then you're dropping it somewhere in the stack. After you
loose the data in question, what do youre /proc/net/dev and ethtool stats look
like?
Neil
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Maximum no of bytes Ethernet can transfer at a time ??
2011-04-28 11:06 ` Neil Horman
2011-04-29 8:39 ` Ajit
@ 2011-04-29 8:53 ` Ajit
1 sibling, 0 replies; 12+ messages in thread
From: Ajit @ 2011-04-29 8:53 UTC (permalink / raw)
To: netdev
Neil Horman <nhorman <at> tuxdriver.com> writes:
I forgot to mention one more thing,
In the sender code you need to edit the mac of the target machine.
you will find it at the start of the code.
Also take care of eth0 to eth1 in the receiver code as per the need.
Thank you.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2011-04-29 19:06 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-27 12:11 Maximum no of bytes Ethernet can transfer at a time ?? Ajit
2011-04-27 12:21 ` Eric Dumazet
2011-04-27 12:27 ` Ajit
2011-04-28 6:36 ` Ajit
2011-04-28 6:40 ` Eric Dumazet
2011-04-28 21:24 ` Rick Jones
2011-04-27 13:01 ` Neil Horman
2011-04-28 5:49 ` Ajit
2011-04-28 11:06 ` Neil Horman
2011-04-29 8:39 ` Ajit
2011-04-29 19:06 ` Neil Horman
2011-04-29 8:53 ` Ajit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox