Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
72 user(s) are online (59 user(s) are browsing Forums)

Members: 3
Guests: 69

Amigafreak02, samo79, nbache, more...

Support us!

Headlines

 
  Register To Post  

Quick networking question
Home away from home
Home away from home


See User information
I've posted a quick networking question over on os4coding (link).

Just cross-posting here because I'm not sure how actively developers visit that site.

Hans

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: Quick networking question
Home away from home
Home away from home


See User information
@Hans


Answred there:

Quote:


If you are coding on AmigaOS4 and don't require backwards compatabilty the easiest solution is to use the interface.

ie

definetly bsdsocket

ISocket->connect()

Otherwise it's being careful about how you order your includes.

Just adding

#include <proto/bsdsocket.h>

Should be enough in most cases as that wil pull in the inlines and those will replace the functions call with macros referenceing ISocket or SocketBase depending on the target (AmigaOS4 or 68k).

It's little easier to be certain with clib2 as there is a separate libnet.a so not linking against that will give erreors if you messed up your inlcudes.


Go to top
Re: Quick networking question
Home away from home
Home away from home


See User information
I've got another networking question: link.

Hans

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: Quick networking question
Home away from home
Home away from home


See User information
@Hans

Replied on thread:

here's copy

This code
#include <stdio.h>
 
 
int main
(int argcchar ** argv)
{
    
char host[256];
 
    host
[0] = 0;
 
    gethostname
(host,255);
 
    printf
("host: "%s"\n",host); 
}

returns the correct hostname for me

eg

Quote:

ram:testhostname
host: "amiga"


Though that is not not quite what you want as that hostname is local to my SAM 440 on the rest of the network it's defeined as SAM in the various local hosts databases. Using fixed ips on my network so the router doesn't knw the hostnames of the machines.

So what does the hostname command return?

eg here on my SAM I get:
Quote:

10.AmigaOS4:> hostname
amiga

which matches up.

Do you actually want the hostname or the address?


Go to top
Re: Quick networking question
Just can't stay away
Just can't stay away


See User information
As far as I know, any host on the network can define another host in its hosts table using any hostname it likes. It acts as sort of a local "DNS" on that host.

And there is nothing forcing you to give a hostname when you hook up to the LAN - at least not when you use a fixed IP address, and I think also not with DHCP.

So (if I'm correct) it doesn't even necessarily make sense to ask for "the name all hosts call a particular machine".

Why do you need it?

Best regards,

Niels

Go to top
Re: Quick networking question
Home away from home
Home away from home


See User information
@nbache

Quote:
As far as I know, any host on the network can define another host in its hosts table using any hostname it likes. It acts as sort of a local "DNS" on that host.

True, but that's NOT useful, especially when your LAN has a router at its centre that does NOT allow you to set static IP addresses.

Quote:
Why do you need it?

To identify machines on the network in a human readable form in an environment where everyone has a dynamic IP address. The information is there (Avast's Wifi Inspector can read it); I just want to use it.

Hans

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: Quick networking question
Not too shy to talk
Not too shy to talk


See User information
@Hans

never come across routers that don't allow static ip addresses, but i know they exist.. but to change it to static ip, it must be set at the routers settings to make it work.. if that ruter isn't accessible because of dhcp rule, then you need too unplug the dhcp master ruter from it and then change settings.. probably need to reset it first

Sam460ex 2GB 120Gb SSD&1Tb HD7750 Envy24HT A-Eon Drv 2.10+Warp3D New Uboot
Apollo v4 Standalone
Go to top
Re: Quick networking question
Home away from home
Home away from home


See User information
@Hans

Ah so what you need is to get a list of machines on the network and then reverse DNS them to get their names.

Really don't know how to do that except by pinging all possible addresses. Which seems like brute force.

This is where we need Olaf B to join the conversation






Go to top
Re: Quick networking question
Amigans Defender
Amigans Defender


See User information
@broadblues

I think it involves ARP tables. I'm not sure if querying from the local machine is sufficient (try "arp -a") or if you need to query the router.

Otherwise you're probably looking at some code to pick up broadcast packets.

I have no idea how either of these things works :D

Go to top
Re: Quick networking question
Home away from home
Home away from home


See User information
Interesting arp -a run on my SAM shows my X1000 and my router (fixed ips) but not the Linux laptop or phone that are both using DHCP

Go to top
Re: Quick networking question
Home away from home
Home away from home


See User information
@broadblues

Yes, that's what I'm trying to do. My original goal was to just get a usable hostname for the local machine (which AmigaOS doesn't report correctly). However, ultimately I want to be able to identify all machines on the network.

Avast's Wifi Inspector is able to do that,** so it's got to be possible.

Hans


** Probably with the exception of machines in "stealth mode" that don't even respond to pings.

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: Quick networking question
Just popping in
Just popping in


See User information
@Hans

In Workbench Explorer, turn on Preview Pane, go to Computer, what does the line "Network device name:" say for you? The name you want?

Go to top
Re: Quick networking question
Home away from home
Home away from home


See User information
@mritter0

I don't get a "Network device name:" line in the preview pane for Computer. This is with the latest version off os4depot (1.8 01/03/2018).

@broadblues
Quote:
Interesting arp -a run on my SAM shows my X1000 and my router (fixed ips) but not the Linux laptop or phone that are both using DHCP

I've found that I have to ping another machine before it's listed by arp -a. However, only the router's name appears.

Hans

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: Quick networking question
Just popping in
Just popping in


See User information
@Hans

OS4Depot latest is v2.2, Dec 19, 2018. Look again. I think it is what you want.

Go to top
Re: Quick networking question
Home away from home
Home away from home


See User information
@mritter0

Oops! I updated the version on the wrong partition. Running with the actual latest version, the "Network device name" is NOT the same as the hostname that's sent to the DHCP server.

Hans

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: Quick networking question
Home away from home
Home away from home


See User information
@Hans

Quote:
especially when your LAN has a router at its centre that does NOT allow you to set static IP addresses.


The ip address is normally assigned sequentially, starting with first in the range where normally the last in range, is least likely to be assigned. In that case I use like *.*.*.254 or *.*.*.253 for static ip' etc. or can just pop a router or network bridge that do not suck in-between.

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: Quick networking question
Home away from home
Home away from home


See User information
@Hans

Quote:

I've found that I have to ping another machine before it's listed by arp -a. However, only the router's name appears.


Ah yes that does appear to be the case. The arp table contains the primary host name the IP and the Mac address of the machines that have been connected to from the machine I run 'arp' on.

If I ping an address that doesn;t exist then I get an incomplete record in the table that disappears after a while.


I wonder if the hostname as presented to the router is the one you want to use in practice, if I copy and paste the hostname of my phone from the DHCP table on my router I can't use that as the domain name to ping it only it's address or domain name as defined in my hosts file.

So

ping all possible addresses in subnet
read arp table
discard incomplete entries
?????
profit!






Go to top
Re: Quick networking question
Home away from home
Home away from home


See User information
@broadblues

Quote:
ping all possible addresses in subnet
read arp table
discard incomplete entries
?????
profit!

That half works for me. I get the MAC addresses, but the hostnames are still missing. Wifi Inspector must have another trick up its sleeve.

Hans

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project