|
I apologize in advance for not posting code, but it would have required the whole "server.cpp" and "clinent.cpp" files, so I reference their URLs at MSDN. I think my question is quite specific; however. Where do I pass the hostname/address parameters? I have tried many locations replacing references, etc with localhost or 127.0.0.1.
Using the MSDN sample client/server code I cannot find where to input the server name/address
argument/parameters. Both the client and the server compile fine.
The server is supposed to receive data from the client and echo it back to the client. In this case both client and server run on the same machine and I believe should use server name or address as localhost or "127.0.0.1".
The Server code can be found at:
http://msdn2.microsoft.com/en-us/library/aa922634.aspx
When I run it I get this message which looks OK, accept I always get odd
characters for type:
"Socket 0x0012f8d8 ready for connection with ╕ ↕ family, öq╜Θê↓╚☺ type, on port"
The Client code can be found at:
http://msdn2.microsoft.com/en-us/library/aa916685.aspx
When I run the client I get this message:
"Server name/address parameter required. Ex: clnt 123.45.67.89
Press any key to continue . . ."
I am not sure (1) where to place the host address
argument, and (2) if it needs to be just passed from the
client side or both.
I have tried placing variations of 127.0.0.1, "127.0.0.1", localhost, "localhost" in various
locations such as "getaddrinfo" area, etc. but I still get the clinet asking for sever parameters or get build errors.
Again, my question is where/how do I tell the client how to reach the server (pass server parameters) and/or do I need to do the same for the server to reach the client for echo returns?
Thanks much
mt
|
|
|
|
|
managetao2 wrote: Where do I pass the hostname/address parameters?
Hmmm. From just looking at the Help-text the clinet emits when called without parameters,
if(argc < 2)
{
Print(TEXT("Server name/address parameter required. Ex: clnt 123.45.67.89"));
goto Cleanup;
}
else
{
...
}
} I think you too will eventually see the light...
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
Hi there,
I'm wondering if it is possible to enable n-up pages per sheet printing by just modifying the DEVMODE structure.
I reconned that its possible to query the dmFields member for value DM_NUP (works for my printer, obviously it supports n-up) and I will get all allowed n-up values by asking the DeviceCapabilities function for capability DC_NUP. (i get an array of 6 DWORD values; 1, 2, 4, 6, 9, 16)
The big question now is how to set one of those values to the printer.
I couldn't find a field in DEVMODE structure where to set the number of logical pages per physical page.
The only thing to be set is who is handling the NUP printing (spooler or application), but no hint from Microsoft how to implement application NUP printing ...
Any ideas?
Thx in advance for any glues ...
Chris
P.S.: I moved this post from article 'Printing Architecture', feel free to move it if it isn't the right place here ...
|
|
|
|
|
I am not sure if I am understanding you. For example... in my project I use a self defined CPrintDialog derived class. I give the possibility of choosing what class of info should me printed (All, Graphics, Text_info, ...) and the large of my print job depends on this as follows. Graphics is 1 page; Text_info is 1-4 or 1-2 or 3-8 (depending of which elements info have to be printed and the actual working project)...
So I can print from 1 to 15 pages but the user don't say how many pages he want to print, just check / uncheck some radio buttons selecting what he want to have printed. All the rest is dinamical depending on number of elements in the actual project.
Is something like that what you are asking for??
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
OK, sry for being not accurate in my 1st post, what I'm looking for is:
o) There is 1 physical printer, all printouts (most of them) are printed on that one ...
o) Customer wants to see one product out of lets say 30 to be printed as 2 pages on sheet of paper (to save paper of course; printout can be up to 80 pages long)
By default the printer is set to print 1 page of printout to one physical sheet of paper. (no duplex).
But for this one special product I have to override printersettings and tell the printer not to print 1 page on 1 sheet but print 2 pages on 1 sheet.
The problem now is how to set that, I haven't found anything in DEVMODE structure to set.
The only thing I'm able to do right now is to get the informatin from the printer if it is capable of printing multiple pages on sheet or not and how many pages it is able to print on one sheet.
Hth,
Chris
|
|
|
|
|
Then, if I understand it correctly... you can not do it as you think. I think you should programatically give the printing output in one size or in another depending in your options. But not overriding DEVMODE, with OnPrint ().
Maybe I am not right and there is a way. If true... I will learn another new thing
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
But how will changing the output size make the printer to put 2 pages on 1 sheet?
I thought that's the purpose of multiple pages per sheet option that the printer is able to handle resizing of each page to fit multiple pages on one sheet?
p.s.: Thx for your quick replies, I appreciate that!
|
|
|
|
|
It maybe is so... but the thing is not all printers have these solution, so the "standards" won't have the specifical parameters of some devices.
I have taken a look into DEVMODE structure... the possibilities that I have found is a mixing of
dmScale, dmPosition, dmDuplex
But I don't know how to make it working for your conditions.
EDIT:
I have check this DEVMODE.
DEVMODE
The DEVMODE data structure contains information about the device initialization and environment of a printer.
typedef struct _devicemode {
BCHAR dmDeviceName[CCHDEVICENAME];
WORD dmSpecVersion;
WORD dmDriverVersion;
WORD dmSize;
WORD dmDriverExtra;
DWORD dmFields;
union {
struct {
short dmOrientation;
short dmPaperSize;
short dmPaperLength;
short dmPaperWidth;
};
POINTL dmPosition;
};
short dmScale;
short dmCopies;
short dmDefaultSource;
short dmPrintQuality;
short dmColor;
short dmDuplex;
short dmYResolution;
short dmTTOption;
short dmCollate;
BCHAR dmFormName[CCHFORMNAME];
WORD dmLogPixels;
DWORD dmBitsPerPel;
DWORD dmPelsWidth;
DWORD dmPelsHeight;
DWORD dmDisplayFlags;
DWORD dmDisplayFrequency;
#if(WINVER >= 0x0400)
DWORD dmICMMethod;
DWORD dmICMIntent;
DWORD dmMediaType;
DWORD dmDitherType;
DWORD dmReserved1;
DWORD dmReserved2;
#if (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400)
DWORD dmPanningWidth;
DWORD dmPanningHeight;
#endif
#endif /* WINVER >= 0x0400 */
} DEVMODE;
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
No worries, cheers anyway spending your time on that!
|
|
|
|
|
Hi Chris,
Infact i was also trying to do the same . Now its done for me .Please follow the below link . You will find ur answer.
http://www.experts-exchange.com/Programming/System/Windows__Programming/A_2090-How-to-set-Pages-Per-Sheet-Programmatically-for-N-Up-Printing.html
If u still have any problem. Please do let me know .
Regards,
Jack
|
|
|
|
|
Thank you very much, sir
I couldn't even remember I was posting here, but anway your link turns out very useful for me, that's for sure.
But it needs to be checked if the private printer data of the DEVMODE structure is really the same for all printers. To be honest, I doubt that. Could be that for another printer the n-up printing byte is somewhere completely different and writing the byte described in your link does something really fancy then ...
|
|
|
|
|
Hi Chris,
For my Printer n-up printing byte turns out to be 159 byte . And you are correct that private members are drivers specific and it need not be same .
So I am trying to find out any way so that we can find out which Byte is reponsible for N-Up print setting . As I have to implement N-Up printing for my applications Print Dialog .
I guess you are also trying to do the same . If you know any way to get that,please let me also know .
I would be really thankful for that .
Regards,
Jack
|
|
|
|
|
Actually, I gave up in 2007 to investigate further on that topic since it was not a customer request but an internal one and we decided not to put more effort in it. So I guess I wont't be a big help here at least not in finding the right byte.
Of course I can offer you to run a compiled test program with the printers we have installed here in my office. I don't want to grab your sourcecode, so if you say you have something compiled already and want some testing on additional printers, you're very welcome!
Maybe if I find some time this week I could at least test if our printers have the N-up byte at the same location in the DEVMODE structure, but we're in the middle of pushing out a new release of our software this week, so I'll be busy with patching and testing most probably
|
|
|
|
|
Is there any VC++6 function that can be used to restart or end the opperating system?
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
|
Thamks!
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
|
Thanks!
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
|
|
Thanks again!
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
Hi all...
I'm looking for a good toolkit (with source) that will help me build a character based user interface for console applications using C++ in Visual Studio 2005. I'm doing a retro app, and I can't seem to find a good tool-kit that will let me define windows with different characteristics (allow word wrap, scrolling, borders, etc) and (preferably) use ANSI escape code graphics. Anyone know of a good one? I kinda want the source to go with it, so I can muddle around with it and see how they do things (doesn't everyone?). Appreciate any help...
=->Mocs<-=
|
|
|
|
|
Does anyone know of any methods for successfully reading an Excel worksheet that has been copied to the clipboard? It would need to be in BIFF8 format.
|
|
|
|
|
Hi,
I have a CListCtrl derived class, where I want control over the subitem painting. The control is in report mode with some subitems. The insertion of items seems to work but nothing appears in the control since I draw all the subitems myself. I figured out that the subitem prepaint stage is never called. The item prepaint stage on the other hand gets called.
What could could be the reason for this problem ?
void CXListCtrl::OnCustomDraw(NMHDR *pNMHDR, LRESULT *pResult)
{
NMLVCUSTOMDRAW *pLVCD = reinterpret_cast<nmlvcustomdraw *="">(pNMHDR);
// Take the default processing unless we set this to something else below.
*pResult = CDRF_DODEFAULT;
// First thing - check the draw stage. If it's the control's prepaint
// stage, then tell Windows we want messages for every item.
if (pLVCD->nmcd.dwDrawStage == CDDS_PREPAINT)
*pResult = CDRF_NOTIFYITEMDRAW;
else
{
if (pLVCD->nmcd.dwDrawStage == CDDS_ITEMPREPAINT)
// This is the notification message for an item. We'll request
// notifications before each subitem's prepaint stage.
*pResult = CDRF_NOTIFYSUBITEMDRAW;
else
{
// ***** This block of code gets never called. *****
if (pLVCD->nmcd.dwDrawStage == (CDDS_ITEMPREPAINT | CDDS_SUBITEM))
{
// This is the prepaint stage for a subitem.
:
:
}
}
}
}
tia
|
|
|
|
|
How can I record and play sound file in mp3 format ?
|
|
|
|