To find out what IP and port NetSprocket is listening to, you can use
the ProtocolGetConfigString() call, which will return a string with the
config used by a particular endpoint. You can then look for IPaddr= and
IPport= in the string returned.
To find out what IP (and I think port as well) a player is connected
to, use NSpPlayer_GetIPAddress() or ProtocolGetEndpointAddress(). I'm
pretty sure this returns the local address and port in some kind of
structure. Sorry I can't be of more help here, I've never used these
calls.
To find out what IP a player is connected from, (ie, the ip of the
remote machine, use ProtocolGetEndpointIdentifier(), which will return
the remote IP address or the remote apple talk node as a string.
Keep in mind that any local IP address might just show up as 127.0.0.1
(ie: loopback) rather than as your machine's IP address, and what's
more even if it does give the machines IP address that's not
necessarily the address someone on the internet should use to contact
you, since you might be behind a NAT. The only way to reliably get your
own externally visible IP address is to connect to someone and have
them tell you what they see as your remote IP address.
Hope this helps,
Ed
On Dec 29, 2005, at 3:09 PM,
zmorris@mac.... wrote:
> Hey everyone, just a quick question. Is there a way to get the
> current ip and port of the local computer's player? For instance,
> what ip and port netsprocket will bind to locally when it joins a
> game? I can specify the host's ip and port but not sure what they are
> locally. I would like to know these before a host or join occurs, but
> even being able to get them for a joined player would be great. When
> hosting, I just remember the port I hosted on, and use the first ip
> address in the list of the machine's ip addresses, which is less than
> ideal obviously. I don't mind digging into the internals of openplay
> if I have to. I would really like to just query the private
> socket/endpoint to know what it is bound to. Thanx,
>
> -----------------------------------------------------------------------
> -
> Zack Morris Z Sculpt Entertainment This
> Space
>
zmorris@zscu... http://www.zsculpt.com For
> Rent
> -----------------------------------------------------------------------
> -
> If the doors of perception were cleansed, everything would appear to
> man
> as it is, infinite. -William Blake, The Marriage of Heaven and Hell
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Openplay-dev mailing list (
Openplay-dev@list...)
> Help/Unsubscribe/Update your Subscription:
>
http://lists.apple.com/mailman/options/openplay-dev/ezavada%40io.com
>
> This email sent to
ezavada@io.c...
>
>
Ed Zavada
Pixel Dust Games
ed@pixe...
http://www.pixeldustgames.com/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Openplay-dev mailing list (
Openplay-dev@list...)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/openplay-dev/subscriber%40opensubscriber.com
This email sent to
subscriber@open...
opensubscriber is not affiliated with the authors of this message nor responsible for its content.