Winsock Netware Address Resolution

Posted on 1998-12-08
Last Modified: 2013-12-03
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.
Question by:FNORD0
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
LVL 27

Expert Comment

ID: 1416863
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!

Author Comment

ID: 1416864
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?
LVL 11

Expert Comment

ID: 1416865
You are using winsock 2?
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now


Author Comment

ID: 1416866
I could use winsock 2 if that would help (or I could NOT use it if THAT would help...)
LVL 27

Expert Comment

ID: 1416867
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, or search for Ralf Brown. I do not however know of a C++ implementation.
LVL 11

Accepted Solution

alexo earned 200 total points
ID: 1416868
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:
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.


Author Comment

ID: 1416869
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.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL ( and MongoDB (…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question