Winsock Netware Address Resolution

I am trying to write a C++ program that will establish an IPX or SPX session using winsock. The parameters I have are the network.node address (e.g., 2739abd5.d6a927c96700) of the server, and the socket number. How do I convert this data to a valid SOCKADDR? I know there's a routine called WSAStringToAddress, but I can't figure out how to use it properly in this case.
FNORD0Asked:
Who is Participating?
 
alexoCommented:
The rat ate bad cheese that made his head dizzy.  Winsock can use IPX.  I have sample winsock sources that use IPX.  I can email them to you if you like.

Also, from the MSVC docs, comes this blah blah:

Use the address family AF_IPX in the af parameter of the socket function for the IPX/SPX protocol.

Use the following protocol families in the protocol parameter of the socketfunction:
  NSPROTO_IPX
  NSPROTO_SPX
  NSPROTO_SPXII
 
To open an IPX socket, call the socketfunctions with an address family of AF_IPX, a socket type of SOCK_DGRAM, and protocol NSPROTO_IPX.

The protocol value must be specified, it cannot be zero because all IPX packets are sent with the packet type field of the IPX header set to zero.

To open an SPX or SPXII socket, call the socket with an address family of AF_IPX, socket type of SOCK_SEQPACKET or SOCK_STREAM, and protocol of NSPROTO_SPX or NSPROTO_SPXII.

If SOCK_SEQPACKET is specified, calls to the recv function are not completed until a packet is received with the end-of-message bit set.

If SOCK_STREAM is specified, the recv function completes as soon as any data is received, regardless of the setting of the end-of-message bit.

Send coalescing is never performed. Sends smaller than a single packet are always sent with the end-of-message bit set. Sends larger than a single packet are packetized with the end-of-message bit set on only the last packet of the send.

0
 
BigRatCommented:
If you actually have a "handle to socket" then the API procedure getsockname will return a sockaddr or address (which you probably have). If you put this into gethostbyaddr you get a hostent struct where h_name is the string you probably want. Confusing isn't it!
0
 
FNORD0Author Commented:
Since I am trying to establish a new session, I naturally don't have a handle to a working socket... I just have the two hex numbers (4 bytes network, dot, 6 bytes node) and I need to convert them into a valid SOCKADDR structure. If it was TCP/IP, I would use inet_addr or gethostbyname, etc., but I didn't find similar (and simple) APIs that do it for Novell IPX and SPX. Any ideas?
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
alexoCommented:
You are using winsock 2?
0
 
FNORD0Author Commented:
I could use winsock 2 if that would help (or I could NOT use it if THAT would help...)
0
 
BigRatCommented:
I'm sorry I seem to be asleep. It must be the cheese I have eaten. You don't establish IPX sessions with WinSock. WinSock is an interface for TCP/IP. IPX/SPX sessions are handled with the Netware IPX API. In this API you take the network node address (which consists of NetworkNumber, a dot and a StationAddress usually quoted as hexadecimal numbers - 4 bytes dot 6 bytes) and stick them in an IPXAddress struct which you use to get the connection (back comes a socket number on connection). These Sockets have NOTHING whatever to do with WinSock. I apologize for not noting that earlier. You need to use a completely different API and I believe you can get an SDK from Novell for it.
   I have only ever done this once - in Turbo Pascal for Windows. I used Ralf Browns starter kit. And I got the introduction from Ralph Davis's Windows Network Programming book. You can find out more at http://descent2.com/ddn/ipx/index.html, or search for Ralf Brown. I do not however know of a C++ implementation.
0
 
FNORD0Author Commented:
Thanks for the explanations, which by the way had nothing to do with what I asked (converting "network.node" IPX addresses to a SOCKADDR structure). Anyway, I have already found the answer myself in some obscure sample, so there is no need to pursue this matter any further.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.