473,326 Members | 2,126 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Is getting response from Webclient.UploadData synchronized

Hello,

I have a executeble that sends a request to a webserver:

Return Encoding.UTF8.GetString(myWebClient.UploadData(uri , "POST",
Encoding.UTF8.GetBytes(postString)))

We are a having a problem that if we run it multiple times in a short time
span something fails. ANd I was wondering if the webclient could be the cause
of problems.

The executeble is started multiple times, so several instances could be
running at the same time. Is it possible for the webclient in one instances
to receive the response from another webclient in another instance?

With kind regards,

Philip Wagenaar
Nov 21 '05 #1
3 1934
Hi

I think we can not do that.
Also per the MSDN, the Webclient is not thread safe, that is to say, we can
not access to it in multithread.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread
safe. Any instance members are not guaranteed to be thread safe.

If you wants to improve the concurrency, I think you may try to start a few
thread, and create a webclient in each thread to do the post and receive.
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '05 #2
Hi,

I have confirmed this. You can run as many webclients simultaniuosly as you
want. The problem was created by another system.

Thank you for your reponse.

""Peter Huang" [MSFT]" wrote:
Hi

I think we can not do that.
Also per the MSDN, the Webclient is not thread safe, that is to say, we can
not access to it in multithread.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread
safe. Any instance members are not guaranteed to be thread safe.

If you wants to improve the concurrency, I think you may try to start a few
thread, and create a webclient in each thread to do the post and receive.
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '05 #3
Hi

You are welcomed!
If you still have any concern, please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '05 #4

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

Similar topics

2
by: Kueishiong Tu | last post by:
I have a url, I pass it to Webclient, and I get response without any problem. String* uriString = S"trade7.masterlink.com.tw/futures/QuotePrice.jsp"; String* postData = S""; // Create a new...
1
by: CLEAR-RCIC | last post by:
I'm trying to use the Webclient class to "POST" to a web site. The website is using basic authentication. Im getting a "(401) Unauthorized" error. Here is my basic code: dim myWebClient as...
0
by: Ramkrishna Kulkarni | last post by:
Hi, We are using UploadData method of WebClient class in C# to establish connection(s) between two machines(typical client/server). Connection is established if the machines are on same domain. If...
0
by: Al Cadalzo | last post by:
I'm using VS.Net v7.1.3052 I'm using WebClient to do a POST: Here's a code snippet: (C#) Byte responseArray = null; try
4
by: Paul J. Lay | last post by:
I am sending and receiving multipart messages using the WebClient UploadData method Method=Post. Everything seems to work well except when the URL contains parameters. For example:...
1
by: Stacey | last post by:
I am receiving the response upon using webclient.upload method which contains the "order number" and related information strings followed by standard stuff under <HTML> <HEAD> elements. I...
4
by: Lehel Kovach | last post by:
I'm having a problem with the WebClient object. When I post data to certain sites, it will receive a command from the webserver (object moved) and continue to the next link by downloading that. ...
2
by: Tosco | last post by:
I read many examples with NetworkCredential and WebClient, but no one with a real http address. They all work in theory, but I wasn't able to use them in the real world. The following code should...
0
by: y2ktan | last post by:
Hi All, I try to use WebClient.UploadData to upload a photo with the size less than 1MB to my local IIS. I setup my IIS by adding a new virtual directory with the write access to the photo...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.