Go Down

Topic: Ethernet shield - webClient example (Read 6477 times) previous topic - next topic

Ray Andrews

Yes, but you cannot assume the default subnet is the correct subnet. For instance, I have a fixed range of static IP addresses available, its a class A network, but I cannot use 255.0.0.0.  A workplace network might have multiple departments all running on a 192.168.*.* network, but each department could be limited to 16 or 32 addresses.

Again, you almost always can assume the subnet or gateway, but it shouldn't be coded, it should be up to the programmer to make that assumption

kg4wsv

Quote
Again, you almost always can assume the subnet or gateway, but it shouldn't be coded

The default netmask is defined by the IPv4 standard.  It can and should be coded.  Every single network capable operating system I have ever encountered allows one to use the default subnet mask.  Why would you remove this from the arduino?

You're on a network that does not use a default netmask; big deal. I've been on a network where the netmask changes depending on which subnet you're on.  If the user is on such a network they will likely be assigned an address anyway (which will come with subnet and router data!), instead of being allowed to run amok and chose an IP configuration by rectal extraction.

The simple fact is that most arduino users will be on a network where the default netmask is correct and the default router is .1.  The arduino is meant to be easy to use.  connect the dots...

-j

Ray Andrews

I'm not in any way suggesting that any functionality be removed.

Again, yes, you can determine the "default" subnet, but that doesn't make it the correct subnet for the programmer/user.  Programming should be a codified set of rules, not assumptions. Carrying the assumption out a little:  Most arduino tinkerers are probably starting out on a home router, most home routers come shipped as 192.168.(1 or 2).1  so should this address be assumed to be the default gateway.

I'm not inferring either that programmers should just randomly choose an IP configuration by "rectal extraction" (I like that one), in fact I'm saying just the opposite, that if the programmer doesn't know the correct settings, then the library should not help him by making assumptions.


kg4wsv

Quote
Programming should be a codified set of rules, not assumptions.

There are codified assumptions all over the place in the software world.  We call 'em "defaults".

In another thread it looks like the DHCP client is making progress, so hopefully this will all be a moot point soon.

-j


linux-works

check CIDR!

classless IP is with us.  stop thinking in pure class A B C things.  this isn't 10-15 yrs ago, mate.

I can't believe that this is still an open issue.

you have broken code and proven examples of how it screwed over a user.  you think that's a Good Thing(tm)?

go talk to a routing company and suggest they put dot1 in their last octet as a router.  go see what kind of laughter you get from them.

(I used to work for cisco, juniper and many other networking companies.  and I, too, would laugh in your face if you suggested that dot-1 was anything more than some dumb convention that SOME HOME USERS have.)

this shouldn't even be DEBATED.  its butt-obvious to anyone who plays in the IP world.

I need to step away, again, it seems.  this is too frustrating having to argue about basic IP topology issues to THIS length.

go read a book on ip networking.  see how 'frequent' it is that they recommend you just automatically assume a router's ip address.  show me some citations - if you can find any.

linux-works

DHCP does not make this moot.

you STILL need to provide sane time-proven ways to configure your ip host.

slamming in a dot or a series of 255's is wrong wrong wrong.

wrong.

just simply wrong.

stop trying to defend a basically ignorant assumption about how ip works.

"it works at MY house and my mommies house, too"

good logic. folks.  nice way to write APIs.

linux-works

fwiw, I purchased a static block of IP from my net provider and I'm a 255.255.255.240 subnet.

can I 'get by' by faking it to pure class C?  sort of.  kinda sorta.

is it right to assume class C?

no.  no it is not.

lets also talk about ISPs.  my ISP has given me a .70 as my default router ('pro' level DSL from pacbell).

I happen to have a local gateway in my block of 5 or so addresses I can use but if I used their gw, it would be xx.xx.xx.70

so again, your code would not work on my home network using the ASSIGNED router that I get from pacbell.

I don't have a class C address and my router isn't .1

I guess the ard code is just not 'supposed' to work for folks like me, hmmm?

wow - the arduino codebase.  we need a new slogan:

"well, it works FOR US..."

sheesh!


kg4wsv

OK, no more caffeine for you today...
Quote
stop trying to defend a basically ignorant assumption about how ip works.

Ignorant? Hmm, let's see: BS computer science; have nearly finished MSE computer engineering; 20 years supporting engineering workstations and networks including a few years as backup network admin for an engineering network at NASA's Marshall Space Flight Center; design and implementation of various instructional networking labs; network engineer training on (at the time) big name commercial routers; designed protocols for theoretical network hardware and implement same on simulated hardware; I've even transferred data between my moving vehicle and the International Space Station (that was neat).

Opinionated? you bet.  Ignorant on networking?  I beg to differ.

-j (my last post on this thread)

Ray Andrews

#38
May 01, 2009, 08:43 pm Last Edit: May 01, 2009, 09:14 pm by SteelToad Reason: 1
Put simply:

Assuming .1 gateway:  Works for the majority
Requiring a gateway: Works for everyone
---------------------------------------
Assuming a subnet:  Works for the majority
Requiring a subnet:  Works for everyone

estranged

#39
May 02, 2009, 10:49 pm Last Edit: May 02, 2009, 10:52 pm by estranged Reason: 1
Quote
Put simply:

Assuming .1 gateway:  Works for the majority
Requiring a gateway: Works for everyone
---------------------------------------
Assuming a subnet:  Works for the majority
Requiring a subnet:  Works for everyone


This suggests that somehow the current *option* to have a default subnet and gateway means that there is *no way* it will work for those who have a different situation.  There are multiple forms of the constructor, some which allow for defaults, and some that allow full configuration.

Now, if the argument is primarily about what is a 'right' thing to teach those who are just getting into networking, I think that's a valid discussion.

My personal feeling is that "Assuming a subnet:  Works for the majority" is a good definition of a default value.

jon_s

Hi everyone, I'm hoping someone can help me figure out how to get WebClient to run. I'm a relative network noob but I've read through all the threads I can find on this.

My setup:
1. OS X 10.5.8, computer is internet sharing my airport connection.
2. WebServer sketch seems to work fine using ip of 192.168.2.3.
3. Ping to 192.168.2.3 seems to work fine.
4. Yet WebClient connection fails after about 1 minute of "connecting..." I'm using the standard WebClient sketch with the following declarations:
Code: [Select]
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 2, 3 };
byte subnet[] = { 255, 255, 0, 0 };
byte gateway[] = { 192, 168, 2, 1 };
byte server[] = { 64, 233, 187, 99 }; // Google

FYI, ifconfig en0 produced:
Quote
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
     inet 192.168.2.1 netmask 0xffffff00 broadcast 192.168.2.255
     inet6 fe80::21f:5bff:fef3:7a1f%en0 prefixlen 64 scopeid 0x4
     inet 169.254.25.48 netmask 0xffff0000 broadcast 169.254.255.255
     ether 00:1f:5b:f3:7a:1f
     media: autoselect (100baseTX <full-duplex>) status: active...


Any suggestions? Many thanks!

mem

try a different  google address, for example: 216,239,59,147

Ran Talbott

The reason mem suggested a different IP address is that google has done some rearranging of their server network,  and 64.233.187.99 doesn't work for direct end user access anymore.

Running a
Code: [Select]
host www.google.com returns some alternatives:
Quote
www.google.com is an alias for www.l.google.com.
www.l.google.com has address 66.102.7.99
www.l.google.com has address 66.102.7.103
www.l.google.com has address 66.102.7.104
www.l.google.com has address 66.102.7.105
www.l.google.com has address 66.102.7.106
www.l.google.com has address 66.102.7.147


66.102.7.103 worked for someone who asked about this the other day.

Ran

jon_s

Thank you for the suggestions, but those addresses gave me the same result. Should I be trying other (less frequently rearranged) sites? Should I try playing with wireshark? Thanks!

Ran Talbott

Next step is probably to try connecting a laptop or other device with easier access to diagnostic info in place of the Arduino,  and see whether there's a configuration problem in the Mac that's preventing it from forwarding traffic.

Or,  it would be for me:  if you're already up to speed on wireshark (I'm not),  you may find it faster and easier to snoop around with that.

It might also be useful to watch the data transfer stats on the network cards for hints on whether packets are being forwarded.

(Yes,  this means that my guess is that it's likely your gateway isn't gateway-ing).

Ran

Go Up