473,698 Members | 2,603 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Web Services, reading standard input and deadlock

I wrote a simple Windows Application based application in C# called the
CallWebServiceG ui. This application is started from a different application
called WsGuiStarter. The WsGuiStarter redirects the standard input from the
CallWebServiceG ui as a simple method for inter-process communication (IPC)
between the two applications. For the reason of IPC the CallWebServiceG ui
creates a new thread, starts it and in it waits for input from standard input.

But if you do such a thing, every call to the WS proxy deadlocks - even the
constructor call to the proxy. So I guess this is a possible bug or me
missing something obvious.

Words can't describe as much as code, so I'm throwing in a couple of code
snippets for the above two solutions.

The CallWebServiceG ui code (a simple form with a button that invokes a web
service and a thread that is listening for standard input in IPC means):

public partial class CallWebServiceG ui : Form
{
public CallWebServiceG ui ()
{
InitializeCompo nent();
}

private void CallWebServiceG ui_Load(object sender, EventArgs e)
{
new Thread( new ThreadStart( WaitForInput ) ).Start();

// Give thread time to start...
Thread.Sleep( 200 );
}

private void WaitForInput ()
{
Stream stdin = Console.OpenSta ndardInput();
// Wait for input...
int rv = stdin.ReadByte( );
}

private void buttonHelloWorl d_Click(object sender, EventArgs e)
{
// !!! Deadlock HERE !!!
HelloWorld.Serv ice hw = new
TestWebService. HelloWorld.Serv ice();
// !!! Never gets here !!!
string str = hw.HelloWorld() ;

MessageBox.Show ( str );
}
}

The web service above is the default HelloWorld web service generated by
VS2005 when creating a WS project. Not a single line of code was changed.

Here is also a code snippet for the starting application - the WsGuiStarter.

public partial class WsGuiStarter : Form
{
public WsGuiStarter()
{
InitializeCompo nent();
}

private void buttonBrowse_Cl ick(object sender, EventArgs e)
{
if ( openFileDialog. ShowDialog() == DialogResult.OK )
textBoxPath.Tex t = openFileDialog. FileName;
}

Process process = new Process();

private void buttonRun_Click (object sender, EventArgs e)
{
process.StartIn fo.UseShellExec ute = false;
process.StartIn fo.RedirectStan dardInput = true;
process.StartIn fo.FileName = textBoxPath.Tex t;
process.StartIn fo.WindowStyle = ProcessWindowSt yle.Normal;
process.Start() ;
}
}

If the CallWebServiceG ui doesn't have it's standard input redirected it
works perfectly. If it does, it deadlocks. Just for clarity's sake let me say
that the web service URL is correct, the HelloWeb service is running, both
project work, the web service call is not being the reason to block (I know I
have to wait a bit to get the response from a WS). Therefore I'm pointing out
again that the above sample works flawlessly if it doesn't have the standard
input redirected. If it does, it deadlocks.

I'd really like to know if this is a bug or not. Standard input seems like
an elegant and simple way of IPC (communicating between processes) and I
would really like to use it over any other method - for simplicity's sake and
not for me not knowing any other IPC technologies.

So is it a bug or me doing something wrong? I can also share a .zip
containing the whole solution to test the above stuff through.

Thanks!
Miha

Sep 15 '06 #1
0 1342

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
5974
by: javastudent | last post by:
Hi, I am implementing a server that reads for socket connections at a port, and processes the socket on a separate thread. We do not control the client implementation. Here is the scenario. 0. Client connects to the socket. 1. Client writes to the socket. 2. Server reads from the socket. 3. Client waits for the response on the socket
1
7047
by: fabrice | last post by:
Hello, I've got trouble reading a text file (event viewer dump) by using the getline() function... After 200 - 300 lines that are read correctly, it suddenly stops reading the rest of the file... Thank you to all of you who can help me with this one...
3
7623
by: Nigel Robbins | last post by:
Hi There, I'm getting a deadlock when I have two clients running the following statement. DELETE FROM intermediate.file_os_details WHERE file_uid = ? AND obj_uid There is a compound index on file_uid / obj_uid. The isolation level is UR and I have set DB2_RR_TO_RS=YES. Any thoughts why I'm getting the deadlock ?
6
6213
by: Gus Tabares | last post by:
Hello, I'm having trouble reading in a character. Here is a snippet of code: int num; char character; printf("Enter a number: "); scanf("%d", &num); printf("You entered %d.\n", num);
2
1650
by: Kyle0654 | last post by:
I've been searching for a solution to this problem for a while but haven't hit upon anything yet. Details: Using: MSVC++ .NET 2003 App type: Windows Forms Application (Managed C++) Description: I'm creating a new Process using the Process class which runs a command line program. However, sometimes the command line program
0
2291
by: Lou Evart | last post by:
DOCUMENT CONVERSION SERVICES Softline International (SII) operates one of the industry's largest document and data conversion service bureaus. In the past year, SII converted over a million pages to a variety of formats. SII's service bureau has a reputation as being a least-cost provider that can offer a timely turnaround with 100% accuracy. Here are some of the formats SII has converted over the last 20 years:
4
1680
by: Dica | last post by:
we just ordered VS 2005 standard edition. i was reading up on creating windows services and apparently this is only possible with the enterprise edition. is this true, or does it simply mean there's no template for windows services with the standard edition? are there VS templates published by 3rd parties i can download to ease implementation? tks
3
2009
by: bob_jeffcoat | last post by:
Hi, I'm trying to read the output and write the input of a process using its StandardOutput/Input and I'd really like to check if the process is waiting for input or whether it has output ready to be read. Is it possible? It seems like a fairly simple thing to try and do but most of the "read" functions I've tried seem to deadlock if there's nothing to read due the process waiting for output. It's rubbish! Even a simple "try for...
3
2589
by: NaN | last post by:
Hi I'm using Dev-C++. Here is my sourcecode. /* GETCH.C: This program reads characters from * the keyboard until it receives a 'Y' or 'y'. */ #include <conio.h>
0
8680
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9030
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7738
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4371
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2335
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.