Asynchronous Socket Library Not Updating Form
Nov 23, 2011
I am attempted to write a small asynchronous socket library that I can use to create a client/server application. I can get all of the code to run fine if I leave it in the form, however if I try to move it out into its own class, I cannot figure out how to update the form with connection status, things like that. Below is code, shortened a bit just to make this easier to read and type.
[Code]....
There is actually more to that class, but I never get anything after the first message goes out. I'm not sure where to go from here. I've tried lots of different methods that I've found on the google searches, some from here, some not.
View 1 Replies
ADVERTISEMENT
Feb 23, 2010
i'm creating an Asynchronous socket programming in vb.net. i've utilised the code from Asynchronous client and server code frtom the following links:m a new user so could post only one link fully)When I try to connect the for more than one client the second client always waits until the first clientcompletes the call. i want the clients to accept calls at the same time
View 1 Replies
Feb 6, 2011
I have closed the client socket using client.close() but netstat command shows the same socket in time-wait state.Because of this I am unable to reuse the socket..
View 2 Replies
Mar 21, 2012
I have a Class called SocketSvr which handles an asynchronous socket server. It is called via the BackgroundWorker from my main form. Basically, I just want it to display my socket data information inside a textbox in the main form, and have a server start/stop button available on the main form to do those things.
Here is the code from Form1.vb:
Public Class Form1
Dim WithEvents Socketsvr As New SocketSvr
Private Sub ToggleServerButton_Click(ByVal sender As System.Object, _
[code]....
I am uncertain how to properly shut down requests from the client when the StopServer() function is run. In the code above, I place a cancellation queue for the background process. The funny thing is that once StopServer() is run, it will accept one more connection, then stop accepting thereafter.If I remove the following line from the code above:
listener.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1)
-- it crashes when I attempt to start the server a second time (complaining that I cannot reuse the socket, obviously) My guess is that I need to add something to the bw.CancellationPending call on the background worker?
View 1 Replies
Feb 2, 2011
I am facing problem in asynchronous socket communication.
1)I wanted to perform connect(from client to server) operation on enter button and send the data whatever client want to send and disconnect from server. And again client should get connect to server whenever client wanted to send data. this is the mechanism.
i.e how to reuse the socket.
2)Again Server should able to send the data to client.
View 5 Replies
Dec 8, 2009
my project was intially mandated to be done in c#.however a large contributor to the project wrote much of the business logic, which he knows well, in vb.net.How difficult would it be to convert the following c# code into vb.net.
[Code]...
View 5 Replies
Feb 12, 2010
I have the following function
Private Function GetMD5(ByVal file As String) As String
Dim md5 As MD5CryptoServiceProvider = New MD5CryptoServiceProvider
Dim f As FileStream = New FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read, 8192)
md5.ComputeHash(f)
[code]....
It works fine, but when working with very large files on the network my users sometimes panic.I'd like to add a progress bar that updates based on the progress of the hashing through the file.So, my choice are either to manually create the hashing process, which I believe will be much slower,or somehow tap in to the position value of the filestream and use that to update a progress bar.I'd be happy to tap into the events of the MD5CryptoServiceProvider if I could, but I don't see anything there.I have searched the net to try to find an example and have only found code that works by reading line by line from the filestream, not from it being passed to another control/service.
View 2 Replies
Jan 31, 2012
A few weeks ago I wrote a wrapper for the ServiceController control to enhance and streamline the base ServiceController. One of the changes I made was to add a monitoring component using the System.Threading.Timer object. On any change of status, an event is raised to the parent class. The actual monitoring works fine, but when the event is handled in the main form, my program abruptly ends - no exceptions, no warning, it just quits. [code]...
View 1 Replies
May 21, 2011
I wrote a Socket Client which will send the Socket Server some data and get some response from Server. This process will be running once in every 2 seconds.
Now what I need to know is How we can identify the connection lost between Server and Client?
I need this to be implemented in the Client side. If there is no connection then Client should automatically close the connection. Once the connection with the server is available in the next attempt it should connect automatically.
View 1 Replies
Feb 6, 2011
I've got some troubles with the socket multithreading, basically the form closes without returning any exception and if I run my application after the compilation it just gives me an error about a yet disposed object (read the code for more information)
I'm quite sure I'm mistaking something in the EndReceive method, anyway that's the resource I've looked into: [URL]..I can't figure out why I should use a state object which contains a socket (or tcpclient etc..) variable instead of some public variables in my current socket class.
View 6 Replies
Jun 7, 2010
i took this code from another example, it works fine but it a windows console application.i took the code into a windows form app but it looks like i have to change somethingto start, it says client is not defined, so what should i use?lient.startClient(clientSocket, Convert.ToString(counter))
Dim serverSocket As New TcpListener(8888)
Dim clientSocket As TcpClient
Dim counter As Integer
[code].....
View 4 Replies
Oct 15, 2011
Below is my code, but when i send the message thru client socket i receive Specified argument was out of the range of valid values. Parameter name: size
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim serverStream As NetworkStream = clientSocket.GetStream()
Dim outStream As Byte() = _
System.Text.Encoding.ASCII.GetBytes("0800822000000000000004000000000000000920092126012345001")
[CODE]...
View 1 Replies
Aug 24, 2009
I have two forms....Mainform is filled with controls that are databound to a datasource.....then I have a child form that is used to edit data from parent form.......the data that is displayed on the child form uses the Filter() method of the binding source to display data only for the customer selected......
The child form has the standard OK and CANCEL buttons set up as dialog result.......after I edit the content in child form, the changes are displayed on the child form correctly......but when closing the child form and going back to the parent form the changes dont appear there unless I restart the application.....I also tried adding the tableadapter.update/fill method in the 'OK' dialog result event handler and it still doesnt work......
How can I make the changes take effect on the parent form without restarting the application?
View 2 Replies
Oct 5, 2009
I have C++ console application, and I dont want to leave it as exe, but I want it to be integrated to the main application written in VB.net..
View 1 Replies
Oct 27, 2009
I have trouble to control my form using with the class library. I am trying to set the form to maximum and set the form border to none. There is an error in come to the end of the statement next to the test.myform.[code]The error I have received is Object reference not set to an instance of an object.
View 6 Replies
Jun 10, 2010
I have a Windows Form application compiled to a .exe that contains standard classes and one windows form class. I would like to reference that .exe in another project. The dialog to add references shows .exe, I add the file to my project, I can see the classes from that file but when I run the second executable I get a "cannot load type" error when I try to access the classes contained in the referenced .exe
That behavior seems strange to me since the IDE accept the .exe as a reference and even "intelisenses" its classes.
I do this because I want a standalone version of the form, but I also reuse it in other project. Am I doing it wrong, what's the best practice in my scenario? I'd rather not maintain both a Class Library project and a Windows Form project that includes the same code.
View 1 Replies
Mar 18, 2009
I have a .net class library with a com class that calls a form. I want to to SetCompatibleTextRenderingDefault(false) to ensure the form fonts look nice.
If I run the command in the class constructor I get the following error:
SetCompatibleTextRenderingDefault must be called before the first IWin32Window object is created in the application.
Edit1: To clarify, I get this error when initiating the class from a .net test harness, if I call it from a VB6 app then I simply get "Automation Error"
Edit2: Is the answer that I cannot use SetCompatibleTextRenderingDefault in a com class when calling from a vb6 app?? Maybe it's the "parent" app that needs to call this method and as such a vb6 app cannot?
how can I make the fonts look nice in a .net class library form called from a vb6 app?
View 2 Replies
Nov 21, 2009
How to get events from dll?Yeah, but i dont know how use addhandler in a function.
View 1 Replies
Jun 20, 2012
i have a query iam able to add items in listbox from form 2 to form1 from windows application in vb.net but iam unable to add items in listbox from form 2 to form1
View 3 Replies
Jan 8, 2011
Im trying to write a simple c++ dll and then reference it in my vb form app however im having a hell of a time doing so. but im getting an error when i call the c++ function in vb.net
here is the c++ code
#include <WINDOWS.H>
LPCSTR DisplayStringByVal(LPCSTR pszString)
[code]....
View 2 Replies
Feb 27, 2012
I'm programming a class library, i want to add form but i need this form to be private so it cannot be seen from outside the library.
View 4 Replies
Jun 21, 2011
I have a Visual Basic Class Library project. It generates a DLL. Is there a method to generate a static .LIB to which I can do a static link?Alternatively, can I do a static link against a DLL?
View 6 Replies
Mar 25, 2012
I have a project that was created as a class library application. It does not have any start up forms. How do I add and show a start up form to this project? Where does this application start since there is no Main Sub that I can find. I am using Visual Studio 2008 express.
View 2 Replies
Nov 21, 2009
I need set events on a class library and catch them in an form.
For example, I run a sub in the dll and I need "receive" the event that the sub in the class is running.
The dll is creted by me in vb, but i don't know how raise events on it to be catched in the form.
View 2 Replies
Jan 25, 2010
i've a app that starts from a sub in a module, do a few things, and then load the form.
But it doesn't work :/
Here we execute dBase.AddTemporalFilepath
module.vb
Public dBase As New Core.clsDatabase
Public Sub Main()
FurBase.Directory = My.Application.Info.DirectoryPath
[Code].....
View 1 Replies
Feb 5, 2011
I'm trying to create a DLL with some useful methods and subs for my use. But when I tried declaring an object for Form or using the keyword Screen, Bitmap, etc.. gives an error saying that "The type 'Screen' is not defined" and like that..
View 7 Replies
Feb 12, 2011
I have a project that will need several forms with a similar structure - a Data Grid View control, a few buttons and some textboxes. They are not similar enough to use just one form and change things programatically so I would like to create a "template" and add several copies of it into my project. My first attempts have failed miserably, ending up with lots of "conflicts" and "duplicate items".
So, how should I save a form from my existing project in such a way that I can then load in multiple copies (giving them suitably different names) without having name conflicts?
View 8 Replies
Oct 11, 2010
I am in the beginning stages of learning VB.NET and all I want to know is how you link a created Class Library to a Form? I've seen code at the top of the designer window that says <dim objSomething as New somethingClass> What the heck is that and how does it work?
View 4 Replies
Apr 22, 2012
I am trying to create a sort of code library in visual basic where the form displays a list box of certain project files in vb that i have made in the past and when clicked, launches the .exe files of those visual basic program project files.I know it does not work the same way as writing/ reading text files to vb and it seems as simple as 'on click, launch .exe of selected string "vb program 1" and so on. I am having trouble getting started on this one. Im sorry I cannot provide any starter code bc I only have a basic understanding of in/out text files which wont work the same way with .exe
View 1 Replies
Jul 28, 2011
I am working on a Windows Forms application in visual basic and one of the features is that it is supposed to access www.usps.com/zip4 and fill in the fields and then display the page in a window with auto-filled fields for the user to edit and submit. Basically I instantiate a WebBrowser, I find each of the fields (two text and a drop-down list) using the webbrowser.Document.GetElementById(id).setAttribute("value", newvalue). I do this for each text field and for the drop down I used setAttribute("value", val) and setAttribute("selectedIndex", index). After I'm done, I attach this webBrowser to a form that I created using form.Controls.Add(webBrowser) and then I call form.showDialog(Me). I have been getting really erroneous behavior. First of all, when this function is called the first time, all the text fields show up ok, but the selection field stays at zero. Neither changing the value nor the selectedIndex changes the actual selection in the drop down list when it's displayed. Then, if I exit this window and have the function called again, all the text is gone and the drop down list appears to be updated with the correct selection; however, it can't be because when I fill in the information and click submit, I get an error saying that I must select a state.
View 2 Replies