Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Winsock Netware Address Resolution

Posted on 1998-12-08
7
Medium Priority
?
414 Views
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.
0
Comment
Question by:FNORD0
  • 3
  • 2
  • 2
7 Comments
 
LVL 27

Expert Comment

by:BigRat
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!
0
 

Author Comment

by:FNORD0
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?
0
 
LVL 11

Expert Comment

by:alexo
ID: 1416865
You are using winsock 2?
0
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 

Author Comment

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

Expert Comment

by:BigRat
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 http://descent2.com/ddn/ipx/index.html, or search for Ralf Brown. I do not however know of a C++ implementation.
0
 
LVL 11

Accepted Solution

by:
alexo earned 400 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:
  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
 

Author Comment

by:FNORD0
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.
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…

971 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