|
I'm trying to integrate into a webservice and haven't done C# in awhile, there is an event that I need to catch after calling a method but I'm drawing a blank on how to do this...ANY help is appreciated.
So what happens is I am uploading a file using the code below and need to know when the upload is complete (as it returns an identifier for the file I just uploaded as well) The webservice description shows "public event ApplyUploadCompletedEventHandler ApplyUploadCompleted;" as a valid event
<br />
try {<br />
objDocushare.ApplyUpload("admin", "xerox", "DocuShare", sProperties, sValues, sParent, filename, data);<br />
}<br />
catch (Exception ex) {<br />
Response.Write(ex.Message);<br />
}<br />
amclint
There's no place like 127.0.0.1
|
|
|
|
|
Not sure if i can post the entire bit of code in here describing the webservice, as I'm not familiar with this posting board, so if that helps I can put the webservice description in here.
amclint
There's no place like 127.0.0.1
|
|
|
|
|
Here is what I've done just now, but UploadFileCallback isn't getting called
<br />
objDocushare.ApplyUploadCompleted += new com.src_solutions.srchq.ApplyUploadCompletedEventHandler(UploadFileCallback);<br />
try {<br />
objDocushare.ApplyUpload("admin", "xerox", "DocuShare", sProperties, sValues, sParent, filename, data);<br />
}<br />
catch (Exception ex) {<br />
Response.Write(ex.Message);<br />
}<br />
<br />
.....................<br />
private static void UploadFileCallback(Object sender, com.src_solutions.srchq.ApplyUploadCompletedEventArgs e)<br />
{<br />
Console.WriteLine(e.Result.ToString()); <br />
}<br />
amclint
There's no place like 127.0.0.1
|
|
|
|
|
I think you would be better off looking at asynchronous[^] web service calls. Invoke your web method asynchronously and wait for the callback. Use the callback to pass back status information about the upload to your calling code.
Paul Marfleet
|
|
|
|
|
Ah, that is so simple and effective, thank you it works great.
amclint
There's no place like 127.0.0.1
|
|
|
|
|
I am trying to read a variable number of bytes from another .Net application but the messages are not always received correctly, sometimes I read the first half of the message and then the second half. Since the message sizes I am sending are constantly changing, I know I cannot hardcode the receive buffer. Right now that is how I have it and it works most of the time when my update rate is 1x/second but not at 10x/second. My data is a string with ids and data values (id:value|id:value|...) that I convert to bytes before sending (.GetBytes(dataString)).
I keep reading on forums that the standard way of remedying this situation is to append the number of bytes to the front of the message but I cannot find any examples of how to do that. Some of the channels have a more data than others (40KB vs 500 bytes) but the sending routine is the same so I need to make sure it will work across all channels.
Any help would be appreciated - I am really on a tight schedule
thanks in advance
|
|
|
|
|
captainmogo wrote: I keep reading on forums that the standard way of remedying this situation is to append the number of bytes to the front of the message
Standard? I don't know if I would agree with that. In any event you are talking about a protocol[^].
|
|
|
|
|
When i was sending / receiving stuff, i would send one message which contains the length of the peice of data, so the receiving end knows what to expect, and had the buffer at say 50KB. The sending end would send in 50Kb chunks until the end of the file, and the receiving end would receive until it had the full 50KB chunk (not all the data comes through in one big chunk) or until it reached the end of the file.
It basically worked like this:
Sender: 123456 <- the size in bytes
Receiver: "OK";
Sender: *sends 50KB*
Receiver: *keeps trying to receive until 50KB has been downloaded*
Receiver: "OK";
Sender: *sends next 50KB*
Receiver: *keeps trying to receive until 50KB has been downloaded*
Receiver: "OK";
Sender: *sends last part of data (less than 50KB)*
Receiver: *keeps trying to receive until the current amount of bytes == total amount of bytes*
Receiver: "OK";
All done. I also had it send an MD5 hash, just to make sure nothing went wrong somewhere.
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
If the buffer size is not hard coded, the process will have to retrieve one byte at a time from the socket and constantly resize the incoming buffer to accommodate the byte until the message has been received. That can be very time expensive.
What can be done is on the receive side, set up a hard coded buffer size. Each time a message is received, pass that buffer up to another method that will parse the buffer copying it into a second buffer. Then the original buffer is cleared. When the next message is received, the same process happens again. Let the parsing method determine when the message is complete and further processing of the completed message is necessary. This requires some analysis of the message and how it is structured so that the receiving process can put the message back together correctly.
There are many applications out there that do the second method effectively. In fact there are some examples on this web site of both methods.
Phil
|
|
|
|
|
I have been mia for the past few weeks but I am finally getting back to it. I understand the concept of your post but I am not really sure how to start implementing that. Would there be some sort of EOF char to determine the end of the message and then only pull out of the buffer up to that point. Would it be possible to maybe get me started on that. Thanks a lot
|
|
|
|
|
I'm beginner, with C#. I've learned basic language C# and Window forms.
Now, I want to build a application what allow create tasks list, appointments, to do list, calender...a desktop application run in system tray, show message at time that defined before...!
I used notify icon, contextmenustrip to minimize program into system tray...but I don't know how to continue develop program?
Somebody show me the way to go on, learn, reference articles or any books for my issues.
Thanks so much!
|
|
|
|
|
hanght wrote: I'm beginner, with C#. I've learned basic language C# and Window forms.
I think you should start a little smaller first.
only two letters away from being an asset
|
|
|
|
|
thanks for your idea! If you can, please give me a smaller project(I'll try it!)
I learned C,C++,VB(not API Programming)! I think I should learn more about system programming(as my project)(I've done a management application).
I hope will receive many your ideas...
|
|
|
|
|
Replacing windows calculator ( just the basic view ) is a good first C# project.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi, Before strat to doing a small project please try to learn ADO.NET concept (if u dont have) , coz, for any project you have to use database.... and the application you want to build will need database to maintain records....
Good luck !!!
Happy Programming
-----
Abhijit
|
|
|
|
|
hi there,
i m trying to set background image of picture box by texture that will be filled by textureloader
but i have a problem that when i m trying to load texture its giving error
that is "Error in application"
codes :
private Texture texture;
private Device gDevice;
...........................
...........................
texture = TextureLoader.FromFile(gDevice, @"C:\asasa.ddt", 256, 256, 0, Usage.Dynamic, Format.Dxt3, Pool.Default, Filter.None, Filter.None, 0);
any idea to solve the problem?
Becoming Programmer...
|
|
|
|
|
It might be helpful to include the error you are getting
only two letters away from being an asset
|
|
|
|
|
"Direct3DXException was unhandled"
Becoming Programmer...
|
|
|
|
|
xmen_xwk wrote: "Direct3DXException was unhandled"
So you're doing Direct3D development but you don't know that you should be posting the contents of the exception in order to receive help. I think you are missing some fundamental aspects of software development while proceeding to a somewhat advanced topic.
|
|
|
|
|
|
|
hahaha, i just wrote what i m getting by VC#
Becoming Programmer...
|
|
|
|
|
Have you tried the view details link on the exception dialog? That should give you more details, including a stack trace that help to narrow your problem.
only two letters away from being an asset
|
|
|
|
|
|
Can i use Lambda Expressions in C# 2.0?
|
|
|
|