vb.net - Swithcing of Threads -


i have vb.net application acts server(echo) , allows clients(another application) query server different type of documents or other files.now problem facing when application(server) up,it runs on single thread.but when client same machine or other machine tries connect server query,the application starts thread connection established server.hence, while debugging server(vb.net application),we find the control switches operations being performed on 1 thread started time server other thread started when client connects server.but want entire operation done on same thread started moment server up.

the second thread started once client tries connect server because using thrid party control name dart tcp connection between server , client,where in client connect server,we using method called in initialize method below code when client connects:

server.start(new connectthreadstart(addressof connectionstart),port,state). here,connectionstart method starts connection , resposible communication between server , client till 1 of 2 ends connection.

any solution or ideas provided appreciated.thanks in advance.

as see, there's new thread started new request (this good).

one (quite bad) way make threads share configuration settings use thread-safe variable in store configuration. when thread needs access it, obtains lock of variable, reads or writes it, , releases lock.

the quite bad part of threads dependent on 1 single resource - make whole application slower nescessary - 1 request lock config variable , others came halt when needed read it. deadlock.

maybe it's enough debugging, though.

more locking of resources here: http://support.microsoft.com/kb/816161

the better thing (avoiding deadlocks) use immutable data structure, nowadays seem available through nuget immutablehashmap


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -