Click here to Skip to main content
16,016,759 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Writting data to CD Pin
verma-rahul3-Sep-04 2:15
verma-rahul3-Sep-04 2:15 
GeneralRe: Writting data to CD Pin
Member 3076123-Sep-04 2:55
Member 3076123-Sep-04 2:55 
GeneralRe: Writting data to CD Pin
Henry miller3-Sep-04 2:57
Henry miller3-Sep-04 2:57 
GeneralConverting 32 bit bitmap image to 24 bit bitmap image Pin
hasansheik3-Sep-04 0:34
hasansheik3-Sep-04 0:34 
GeneralRe: Converting 32 bit bitmap image to 24 bit bitmap image Pin
Bob Stanneveld3-Sep-04 12:15
Bob Stanneveld3-Sep-04 12:15 
GeneralRe: Converting 32 bit bitmap image to 24 bit bitmap image Pin
Ayman Kouzayha30-Jun-10 14:27
Ayman Kouzayha30-Jun-10 14:27 
GeneralRe: Converting 32 bit bitmap image to 24 bit bitmap image Pin
Bob Stanneveld30-Jun-10 20:16
Bob Stanneveld30-Jun-10 20:16 
GeneralInterprocess communication question... Pin
karam_chand3-Sep-04 0:16
karam_chand3-Sep-04 0:16 
Hello,

I want to give SSH based tunneling in my app. My app will then connect to the local port for secure communication over network.

For this I am using PLINK.exe provided at http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Now I want to connect to my server only if PLINK is successful in making a connection to the SSH server.

To do this I am using the following code:

[CODE]
char plinkapp[] = "g:\\myapp\\debug\\plink.exe -ssh -l username -pw pwd -L 1234:127.0.0.1:1235 127.0.0.1";
STARTUPINFO si;
PROCESS_INFORMATION pi;

memset ( &si, 0, sizeof(si) );
memset ( &pi, 0, sizeof(pi) );

si.cb = sizeof( si );
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;

bool pret = CreateProcess ( NULL, plinkapp, NULL, NULL, NULL, NULL, NULL, NULL, &si, &pi );

assert ( pret );

WaitForSingleObject ( pi.hProcess, INFINITE );

/* my server code starts from here */

[/CODE]

Now the problem is that if PLINK is successful in connecting to the SSH server then it spawns up a new shell and waits there for input. So if the connection is successful the code segment is never coming out from WaitForSingleObject() code.

Now I want to execute my code only if the connection is successful otherwise return with an error? How do I find out if PLINK was successfull coz it just opens up a shell and waits there. I cant use some arbitrary millisecond to wait in WaitForSingleObject because if the network is slow then it will take more time to connect to the SSH server.

I was just hoping if there is a more elegant method? I tried piping but then the output after connection depends upon the SSH server which might be Linux or BSD or Windows based. So the output is never same.

The only thing i could figure out is that to modify PLINK source code (its opensource and there are no legal issues )? Do you suggest this method?

Thanks in advance.

Regards,
Karam
GeneralCSockets Windows 2003 Pin
shiraztk2-Sep-04 23:40
shiraztk2-Sep-04 23:40 
GeneralRe: CSockets Windows 2003 Pin
jan larsen3-Sep-04 1:46
jan larsen3-Sep-04 1:46 
GeneralRe: CSockets Windows 2003 Pin
shiraztk3-Sep-04 2:11
shiraztk3-Sep-04 2:11 
GeneralRe: CSockets Windows 2003 Pin
shiraztk3-Sep-04 20:06
shiraztk3-Sep-04 20:06 
GeneralCFtpConnection::GetFile(…) returns Access is denied Pin
anderslundsgard2-Sep-04 23:26
anderslundsgard2-Sep-04 23:26 
GeneralIn-program Custom Panel through Inheritance Pin
Karel Appel2-Sep-04 23:15
Karel Appel2-Sep-04 23:15 
Questionhow to disable device(better "sound device" ) under 98/me Pin
max_xiayi2-Sep-04 22:47
max_xiayi2-Sep-04 22:47 
GeneralMaking the mouse pointer disappear Pin
Matthias19782-Sep-04 22:44
Matthias19782-Sep-04 22:44 
GeneralRe: Making the mouse pointer disappear Pin
Anonymous2-Sep-04 22:57
Anonymous2-Sep-04 22:57 
GeneralRe: Making the mouse pointer disappear Pin
Antony M Kancidrowski2-Sep-04 22:57
Antony M Kancidrowski2-Sep-04 22:57 
GeneralRe: Making the mouse pointer disappear Pin
Graham Bradshaw2-Sep-04 23:47
Graham Bradshaw2-Sep-04 23:47 
GeneralError message and then application crashing.Help Pin
Raghunandan S2-Sep-04 21:34
Raghunandan S2-Sep-04 21:34 
GeneralRe: Error message and then application crashing.Help Pin
Antony M Kancidrowski2-Sep-04 23:01
Antony M Kancidrowski2-Sep-04 23:01 
QuestionMFC Application in MFC DLL possible? Pin
RonnyS2-Sep-04 21:33
RonnyS2-Sep-04 21:33 
AnswerRe: MFC Application in MFC DLL possible? Pin
Antony M Kancidrowski3-Sep-04 2:34
Antony M Kancidrowski3-Sep-04 2:34 
Generaldll problem:how to gain the fucntion's parameters in dll file Pin
williamchou2-Sep-04 20:51
williamchou2-Sep-04 20:51 
GeneralSTL quickie Pin
alex.barylski2-Sep-04 19:47
alex.barylski2-Sep-04 19:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.