Solved

Winsock Netware Address Resolution

Posted on 1998-12-08
7
371 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

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 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:
  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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Get a List of Executing Stored Procedures on Sql Server 2008 R2 5 51
Handle Exceptions during instantiation 28 414
dialer.exe 4 60
What is MicroStrategy.NET? 2 65
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 …
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
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…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

813 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now