Skip to contentSkip to conversation

Maximum no of bytes Ethernet can transfer at a time ??

DISCUSSION Ajit 4 participants 12 messages Apr 27, 2011 – Apr 29, 2011

Subsystems (2)
lore
Share & tools
lore

Ajit

author
#0 lore raw

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.

#1 lore raw
Quoted 11 lines · Ajit

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)

author
#2 lore raw
Quoted 4 lines · 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

author
#3 lore raw
Quoted 11 lines · Ajit <ajitsa_bes <at> yahoo.com> writes:
Quoted 4 lines · 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.

Quoted 8 lines

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 ??

#4 lore raw
Quoted 23 lines · Ajit
Quoted 11 lines · Ajit <ajitsa_bes <at> yahoo.com> writes:
Quoted 4 lines · 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.

Quoted 8 lines

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

Quoted 8 lines

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);

Quoted 5 lines

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)

#5 lore raw
In reply to Ajit
Quoted 8 lines

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

#6 lore raw
In reply to Ajit
Quoted 9 lines · Ajit

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.

Quoted 7 lines

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

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#7 lore raw

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.

#8 lore raw
Quoted 9 lines · Ajit

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.

Quoted 8 lines

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?

Quoted 2 lines

If you still want some explanation then please ask me.

Can you just post a link to the code?
Neil

Quoted 8 lines

Thank you.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#9 lore raw
Quoted 7 lines · Neil Horman <nhorman <at> tuxdriver.com> writes:
Quoted 1 line

Can you just post a link to the code?
Neil

Quoted 3 lines

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.

#10 lore raw
Quoted 21 lines · Ajit
Quoted 7 lines · Neil Horman <nhorman <at> tuxdriver.com> writes:
Quoted 1 line

Can you just post a link to the code?
Neil

Quoted 3 lines

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

Quoted 9 lines

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

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#11 lore raw
In reply to Neil Horman

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.