Re: TCP/IP connection via Ethernet
Re: TCP/IP connection via Ethernet
- Subject: Re: TCP/IP connection via Ethernet
- From: Heath Raftery <email@hidden>
- Date: Fri, 12 Mar 2004 09:06:36 +1100
Apologies, I forgot to send this to the list last night:
On 11/03/2004, at 11:51 PM, Livio wrote:
I need to make a TCP/IP connection between two Macs via Ethernet
(using the first as client and the second as server), is it possible?
Absolutely!
My settings are:
---TCP/IP control panel---
Connect via: Ethernet
Configure: Manually
IP address: 192.168.1.1 (192.168.1.2 for the second mac)
Subnet mask: 255.255.255.0
Name server address: 192.168.1.2 (192.168.1.1 for the second mac)
Looks good so far. The name server stuff is unnecessary though, unless
you are going to run name servers (the servers which convert domain
names to IP addresses).
Then I have an application that opens an endpoint, binds it to the
local address (192.168.1.1) and finally tries to connect to the second
computer's address (192.168.1.2). It always returns with a
T_DISCONNECT event with error 61 in the reason field of the TDiscon
record.
Whoa, hang on, what about the Ethernet connection? Test that first!
Simply use Network Utility or Terminal to ping one machine from the
other. If you get ping responses, all is well. If you don't, and your
test computers are a little old, make sure you are using an Ethernet
crossover cable.
Once you have a network connection, then you can move to higher level
application stuff. A great stepping stone here is netcat, which appears
to come with Panther. Invoke it from the Terminal like this on the
server:
% nc -vvv -l -p 1234
which instructs netcat (nc) to very verbosely (-vvv) listen (-l) on
port 1234 (-p 1234). Substitute 1234 for the port you are trying to
test, or leave it out entirely if you would like the OS to pick a port
for you.
Then on the client:
% nc 192.168.1.2 1234
where 192.168.1.2 is the IP address of your server, and 1234 is the
port you picked (or is reported to you if you left it out) on the
server.
Type some text at each computer, hit return, and confirm that the
transmission occurs. If all that is successful, then you can start
working on your program! Having a network working is quite fundamental
when working on a network app!
On the second computer I have the same application listening for the
traffic.
On what port? Is that the port you are connection to?
Can't help you on the particular error msg you are getting I'm afraid.
A bit of relevant code would go a long way though I would imagine.
Heath
--
________________________________________________
| Heath Raftery |
| email@hidden |
| *He who knows others is wise; |
| he who knows himself is enlightened* |
| - Lao-Tzu _\|/_ |
|____________________________________m(. .)m_____|
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.