Create A Multithreaded Application?
Aug 20, 2009I am using Visual Basic 2008 Express Edition and I want to create a multithreaded application.
View 13 RepliesI am using Visual Basic 2008 Express Edition and I want to create a multithreaded application.
View 13 RepliesI don't want it to be MultiThreaded. i read some tutorials and have a good idea. but unfortuantely all the tutorials on the web write code without explaining. so is anyone here has a good knowledge with Chat application ? I know it's about sockets and stuff but i just need an explaination with code ;)
View 5 RepliesAfter trying to make an application multithreaded, almost towards the end of the processing of 10,000 records, I get a webexception - operation timeout.Now it seems to process around 8000 records just fine, for each record it is also doing some business logic and with it, performing a call to a webservice.
without threading, its fine - no problems. with threading, we hit the issue.so there are 10,000 records to go through. this is of course slow when done in sync mode (Single threading) but much faster when placing items in the threadpool and waiting until completion.
im not sure exactly why the problem happens. how should I debug this when multithreading? its just odd that for around 3/4 of records, the calls are doing very well, then on the last bit to go, it bombs out.
again - no issues when single threading.update: seems to be after around 1000 records that have been processed that it seems to happen.the application calls out to an internal webservice which then does the direct callout to the "outside world" webservice. The internal webservice does some caching but shouldnt have any effect really.
The outside service it is calling is httpBinding. ReceiveTimeout is set to 00:10:00 (10 minutes) and bypassProxyOnLocal="false"im still not quite understanding why it would timeout after 1000 records because it seems to process the others just fine and does come back (or so it seems) when its making a call to the service
I started throwing exceptions on a multithreaded application, and got a mess.There is a good tutorial on managing exceptions in multithreaded applications?
View 4 RepliesI have developed a multithread Windows Application that requires to print various Docss/rpt's off. The problem is I get a "Load Report Failed" error message when creating a new instance of my embedded crystal report.
View 3 RepliesI've finally gotten multi-threading working on my application, but now I'm having trouble showing forms when I need to. I currently have three threads in my program: one for updating a textbox, one for transferring files, and one for displaying forms. Here's a snippet of code from my program:
[code]...
I'm getting the error: Control 'frmXCopy' accessed from a thread other than the thread it was created on. I know what this means, but I can't find a way to make the ShowForm Sub run off of the main application thread.
(Edit: to clarify, my main goal is concurrency, but not necessarily for multi-core machines)
I'm fairly new to all concepts on concurrency, but I figured out I needed to have parallel drawing routines, for a number of reasons:
I wanted to draw different portions of a graphic separatedly (background refreshed less often than foreground, kept on a buffer). I wanted control about priority (More priority to UI responsiveness than drawing a complex graph). I wanted to have per-frame drawing calculations multithreaded. I wanted to offer cancelling for complex on-buffer drawing routines.
However, being such a beginner, my code soon looked like a mess and refactoring or bug-fixing became so awkward that I decided I need to play more with it before doing anything serious.
So, I'd like to know how to make clean, easy to mantain .NET multithreaded code that makes sense when I look at it after waking up the next day. The bigest issue I had was structuring the application so all parts talk to each other in a smart (as opposed to awkward and hacky) way.
I have a preference for sources that I can digest in my free time (e.g., not a 500+ pages treatise on concurrency) and for C#/VB.NET, up to the latest version (since I see there have been advances). Basically I want something straight to the point so I can get started by playing with the concepts on my toy projects.
As the question states, can a shared method of an object be multithreaded? I don't quite having threading down in my skillset, otherwise I would test myself. On the other hand, I am involved in designing class that could be part of a multithreaded application in VB.Net.
View 3 RepliesI have a background thread that waits for data to come in. When data arrives, it fires off a call to the GUI thread.All works just peachy, except if there's ever a run-time exception in the GUI thread. If that happens, the debugger always halts at the point in the worker thread that called the GUI thread. It never shows the proper line that the error occured on.How do I get the debugger to stop at the error in the GUI thread?
Here's the pertinent code from the worker thread:
Code:
Public NotInheritable Class UIThreadMarshal
Private Shared _MainForm As Form = Nothing
Public Shared WriteOnly Property MainForm() As Form
[code]....
I'm trying to build a multithreaded app but I couldnt find anything on google on how to catch the value that the lambda function returns.
ThreadPool.QueueUserWorkItem(New WaitCallback(Function() As Integer
Value += 1
Return Value
End Function))
In a multithreaded application. I have a bunch of function that loop through a collection to read the information. I also have a bunch of function that modifies that same collection.
I'm looking for a way to isolate all the read and the write together. I don't want a write to be done while a read is in progress. I was thinking of using SyncLock on the collection object but this will block multiple read trying to work in parallel.
Given the code, ss there a way to propagate messages send from any of the multithreaded chat client to all the other chat client:
First the main will call startClient:
Public Sub startClient(ByVal inClientSocket As TcpClient, _
ByVal clineNo As String)
[code]......
I have an application using taskfactory that creates multiple tasks which insert records into the same table in a database. I have jobs that cleanup the table when it gets too large and have the execution time-out set to 0 in options in sql server management studio. I keep getting the following error on the tasks when trying to do an insert using a stored procedure and set an exception handling process to sleep and try again. This does not help as it seems it timeouts on almost every attempt.Not sure how to handle this and ensure the table handles all these inserts. Tried including connect timeout = 600 in one of the processes connectionstring but this did not help.Also set sqlquerytimeout value in registry to 90 but still not helping.
ERROR: timeout expired the timeout period elapsed prior to completion of the operation or the server is not responding...
could not see the details of the error since visual studio 2010 debug options had to be set that way, but I will set a responsestream and capture but I rebooted sql server and somehow everything is fine now...not sure why.
Errors have reoccurred.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception,
Boolean breakConnection)
[code]....
I have been reading through lots of sample code and explainations regaurding the uses of Sync lock in multithreaded programs but still am a little fuzzy on this.
Am I correct in assuming that if I have two or more threads running the same procedure which has a sync lock on a shared resource that the first thread to call the lock will complete its update of the resource and any of the other threads to try and lock this object would just wait in line until it is released by the first object?
I am also a bit fuzzy on what is actually locked by the sync lock.
Lets say I have code that uses sync lock and the object specified is the current thread. Does that also lock the shared resources that are referenced within the sync lock block or would I need to use another method to do this?
What if my shared resourses were all in another class and I issue a sync lock on that class before I try to modify the resources would that be the proper way to go about it?
And last but not least is there any need to use sync lock when the shared resource is in effect read only [meaning the program will read the value but will not change it during runtime]
I have a multi threaded app that writes log to file. occasionally, saving fails using this code:
Friend Sub SaveToText(ByVal FileName As String, ByVal Text As String)
'// create a writer and open the file
Dim objLock As New Object
SyncLock objLock
Dim tw As TextWriter = Nothing
[Code] .....
The error message I get:
The process cannot access the file 'error.log' because it is being used by another process.
I have a linq query which loads approx. 1000 lines into a variable, during that process I want to display a progressbar, not necessarily stating the percentage, can be marquee style, doesnt matter.
This progressbar is on a modal form to precent the user from interacting with the app for the time the query's running.
[Code]...
I would like to implement a mulithtreaded crawler using the single thread crawler code I have now. Basically I read the urls from a text file, take each one and crawl and parse it. I know how thread basics of creating a thread and assigning a process to it but not too sure how to implement in the following way:
I need at least 3 threads and need to assign a url to each thread from a list of urls, and then each needs to go and fetch it and parse it before adding contents to a database. [Code] Now the code maynot make sense but what I need to do is add a unique url to each thread to go process.
I'm trying to make a program of mine into a multithreaded application, but I've hit a pair of snags that I documented in the following code. I can expand this stub into a more efficient version of my existing application.
[Code]...
Id like to say that I have a disk to be searched. The same task was run was multithreaded on an extreme x6800 and a new Lenovo W520.
The filescan on the x6800 dual processor extreme searched 1788 files in 477 seconds. The same search on a new WS520 took 82 seconds to search 2149 files. Multithreading works and the X6800 has an ssd and the lenovo has a standard mechancal disk! The task was diskbound.
I would like to make a multi-socket TCP server (to accept multiple clients at the same time).I'm working with Visual Studio 2005 Express, maybe that's why files on CodeBank don't work..I found on the web an example about MultiThreaded Server Socket programming, but this is done for "Console application" in this way:
[Code]...
I'm trying to work out how i can make my multithreaded app stop at a certain point and wait for the user to type something into a text box and click ok. It must then carry on and when a different thread gets to that point it stops again and waits for the user to input some text again.
View 1 RepliesHello I want to create a windows form application program that can create games something like Gamemaker or Klik & Play (butt less advanced) with D&D "Drag and Drop" events and actions.
View 7 RepliesI have written a multithreaded crawler and the process is simply creating threads and having them access a list of urls to crawl. They then access the urls and parse the html content. All this seems to work fine. Now when I need to write to tables in a database is when I experience issues. I have 2 declared arraylists that will contain the content each thread parse. The first arraylist is simply the rss feed links and the other arraylist contains the different posts. I then use a for each loop to iterate one while sequentially incrementing the other and writing to the database. My problem is that each time a new thread accesses one of the lists the content is changed and this affects the iteration. I tried using nested loops but it did not work before and this works fine using a single thread.
Here is my
SyncLock dlock
For Each rsslink As String In finallinks
postlink = finalposts.Item(i)
[CODE]...
Finallinks and finalposts are the two arraylists. I did not include the rest of the code which shows the threads working but this is the essential part where my error occurs which is basically here postlink = finalposts.Item(i) i = i + 1
ERROR: index was out of range. Must be non-negative and less than the size of the collection. Parameter name:index
I tried copying it to a new list but dosent work.
How can I create a VB application in VS2008 without requiring the application be run on a computer with a .NET framework in place?
View 4 Replieshow to create a uninstall command for a Windows-based application in the Application Folder when creating a new setup project in visual studio 2008.
View 4 RepliesI understand this is possible but I am not sure where to start. I want to either buy or create an application that captures a resource from another application so that I can fire off another application. In other words, I want to start an application (which I did not write) that is database driven so the form has a number of text boxes. When someone keys something into that field I want to be able to validate the value, outside of the original application. For instance, if the program asks for a zipcode and it doesn't validate the zipcode, I'd like to trap for that and write something that would validate it. At this point I don't think I'd have to send anything back to the textbox/resource.
View 1 RepliesI would like to implement a mulithtreaded crawler using the single thread crawler code I have now. Basically I read the urls from a text file, take each one and crawl and parse it. I know how thread basics of creating a thread and assigning a process to it but not too sure how to implement in the following way: I need at least 3 threads and need to assign a url to each thread from a list of urls, and then each needs to go and fetch it and parse it before adding contents to a database.
[Code]...
I made a simple TCP server (I've found the example on the web) in VB to receive data from about 40 TCP clients.The clients are not synchronized but sends data about every 18 minutes; the problem is sometimes several clients sends data at the same moment, so I can't receive data.I also made a second program that reads the data (server program writes data on a file, read from the second program) scheduled.
My question is this: I've seen on the web examples about Multithreaded Server Socket Program, so I suppose this could manage my 40 clients (but now the clients are syncronized and send data at the same time in client mode) or is better get data (I have a central client that asks data to all 40 devices in server mode)?
Second question: can I make a single program where I run both TCP client and TCP server at the same time?
I am unsure about how to go at this, what I want is to create an application that can connect to others using that application. Things such as if I change something on the forum it will be changed on someone else who is looking at the forum, granted it would be a specific person who i am connecting with,
View 4 RepliesI want to create a web application where I can read and write data into MS SQL data base or an .MDB file (for testing), pls guide me what should be the mean of connectivity to database? ADO /ADODB /OLEDB
View 6 Replies