Prevent The Application Is Closed, When Close The Server Socket

Jan 12, 2012

I created a server-client application using the asynchronous socket. I found the problem when closing a socket on the server, applications so closed. The procedure that I do to close the socket server is:

Terminate the listening thread. Close the client socket is still connected to the server. Close the server socket.

How to prevent the application is closed, when I close the server socket?

Protected Friend Sub CloseServerSocket(ByVal IPAddress As IPAddress, ByVal socketPort As Integer)
' Terminate the listening thread.

[Code].....

View 1 Replies


ADVERTISEMENT

Socket Programming - Close A Connection From Server?

Nov 24, 2011

I have the following code in my Server Form:

Imports System.Net, System.Net.Sockets
Public Class ServerForm
Private serverSocket As Socket
Private clientSocket As Socket

[code]....

for the first time, when I click on Connect, it is going to connect to server as well and also it works if you click on the disconnect. for the second time if you click on the Connect button, it gets connected but the disconnect button is not working.

View 9 Replies

Close Application When Any Form Is Closed?

Jun 8, 2009

I have multiple forms in my VB.NET application. How do I make it so that any form I close will terminate the application?

View 3 Replies

Identify Connection Lost Between Socket Server And Socket Client?

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

Socket.Close - TCP/IP ASCII Communication

Nov 24, 2011

I'm developing a VB.NET class that connects to one machine that has TCP/IP ASCII communication. I'll show the code and try to explain what is the problem:

CODE:

View 7 Replies

Info: Multithreaded Server Socket Program Or Client/Server?

Oct 26, 2011

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?

View 1 Replies

VS 2010 How To Prevent Fields Being Reset In Form1 & Form2 On Program Close

Nov 18, 2011

I am Matthew and I'm extremely new to coding and any sort of scripting language; yet I am highly interested in programming and want to learn lots about this subject. So to start myself off I am trying to create some applications which I could use in day-to-day life to just basically make life easier.So the first program I am trying to make I am already confused and not sure what the heck I have to do in order to get it functioning, I've looked on lots of videos on you tube for tutorials and they have all done a great job but some videos just don't answer my questions.When I click a button and "Form2.Show()" appears, how can I make it so that when I type text in a list box in form2, it doesn't disappear when I close it? Then once I have known done that, how can I make it so I can choose a random string of text in the list box on form2 to show up on the click of a button on form1? Then a final question is, How do I prevent fields being reset in form1 & form2 on program close? Also, is it ok for me to make a thread asking 1 simple question? or do I have to ask a handful each time to save threads or something?

View 30 Replies

Click My Close Button The Application Will Close But The Debugger Is Still In Active?

Nov 29, 2009

It seems like whenever i click my close button the application will close but the debugger is still in active.How to exit this debugger? :)

View 2 Replies

.NET End Vs Form.Close() Vs Application.Exit Cleaner Way To Close One's App?

Feb 12, 2011

sometimes, when I use Form.close() when debugging my program, although the form is closed, the application is still running. I noticed this behaviour when using the msgbox function.

View 3 Replies

Close Windows Calculator In .net 2008 When Application Close?

Aug 30, 2009

how to use windows calculator in vb.net 2008?

use System.Diagnostic.Process.Start(calc)

its working but i want when application close it also close this calculator how?

View 3 Replies

VS 2010 : Determine Whether A Form Was Closed By Clicking The "X" Button Or By Calling Me.close?

Oct 15, 2010

Is there any way to determine whether a form was closed by clicking the "X" button or by calling Me.close? They both fire the FormClosing event, but I need to determine how the form is being closed so I can do different things.

View 7 Replies

Chat (Using Socket) Server In Web Hosting?

Nov 29, 2011

Read this: [URL]. Now the question: I want the client will connect to web server (or web hosting).

View 8 Replies

How To Connect Socket To Server Rapidly

Jan 23, 2011

I'm using sockets to connect to servers and for some strange reason I can't identify, the socket is taking several seconds (5 maybe 6) seconds to connect when using an IP whereas is instant when using a hostname. Here is my code to connect:[code...]

In the above code, server of course is a string. I've tested this with a friend and she's experiencing the same issue and I'd like to get around it as it's sort of annoying..While debugging GetHostEntry is the line that seems to take forever when using an IP.

View 1 Replies

Socket Server, Windows Form App?

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

Socket Server: Transferring To WinForm App?

Dec 16, 2008

transfer this from a Console app to a WinForms app? I'm still new to this and I want to build on top of this once I get more acquainted with VB.net. I don't know if this may be helpful, but I'm using Visual Studio 2008 (not express).

The Server Code I Found Online:

Imports System.Net.Sockets
Imports System.Text
Imports System.IO
Imports System.Net

[code].....

View 1 Replies

VS 2010 IRC Server - Socket System

Aug 3, 2011

i'm creating an IRC server and I already have a few base classes complete like logging and Config. I was about to start with programming the socket class(es) when I realized that I have no idea how to make such a complicated socket system. I do not under any circumstance want to use any other code than my own since that would not help me learn sockets. I am familiar with a single connection socket system like most tutorials use.

[Code]...

View 2 Replies

DB/Reporting :: Check All Connections To Sql Server 2005 Are Closed?

May 29, 2009

In our VB 2008 we are making a lot of connections to sql server 2005 databases. Is there a possibillity to check with a program or a tool of 2005, all connections are closed?

View 3 Replies

Client Server Winsock Or Socket Programming?

Jul 14, 2009

how to access client side activity i.e. which client is connected and which computer connected at the same time from server.

View 1 Replies

Communications :: Socket - Connecting To Port 80 Of Server

Apr 21, 2008

I am new to socket communication. I found a few samples on the web and I managed to make my own host-client communication but i wanted to go a bit further and connect to port 80 of a server and it was just a disaster! First of all I know I can just use the functions that vb has itself but I want to make my own connections ... I have got some reasons I need this one! Do I really have to make them "connect" or just somehow without connecting I get the data? So I'm stack at the point that the connection is made ... it refuses to connect.

View 7 Replies

Socket Server Crasher - Enter IP And Port?

Mar 11, 2010

I have an application to make a server and clients to read/ send text to it but I want a program I can run from a remote computer that you enter the ip and port and it crashes the server.

View 2 Replies

VS 2008 - How To Get Image From HTTP Server Via Raw Socket

Apr 7, 2010

I am using Async socket class to handle HTTP data. The OnRecieve event handler looks like this:
Private Sub sck_onDataArrival(ByVal sData() As Byte, ByVal BytesTotal As Integer) Handles sck.onDataArrival
Try
Dim ms As New IO.MemoryStream(sData)
Dim returnImage As Image = Image.FromStream(ms)
Picturebox1.Image = returnImage
Catch ex As Exception
Debug.Print(ex.ToString)
End Try
End Sub

I realize this will not work because the byte array still contains the header information from the response from the server. How to strip this data without converting the byte array to a string. I need to strip the header response information and just be left with the image data and from there convert that data into a stream so the stream can be loaded into an image and displayed in my picturebox.

View 8 Replies

.net - Check The Connection State Of A TCP Server (Socket) With TCP Client?

Apr 23, 2012

For almost a week I am reading and trying to find a solution for checking connection state using a TCP Client (using socket class) In my scenario I have a TCP Client that is connected to a server (it is not controlled by me) and i want that from time to time to check the connection state, and reconnect if necessary.I have read a lot of information on the internet but i did not find a suitable solution.Briefly, these are the methods that i have found on the internet and try to implement.But unfortunatelly, i have found some scenarios where the TCP Server is closed and the TCP Client is still saying Connected 1.Example from MSDN

[code]...

View 1 Replies

Get The Client Connection Parameters Of The Socket On Server Side?

Sep 13, 2011

I want both the client and server to write and read resp. at a constant rate (which can be configured on the GUI of the client) to the buffer.I am able to send from the client at 150 bytes per packet Now, I should be able to read also at 150 bytes per packet on the server too Since, both are connected through a socket, can we retrieve the socket params (set on the client size, like 150 here) from the server end, using the tcpServer object.Or is it must to send an initial setup packet which tells about these client params and so accordingly the server can continue?

View 1 Replies

Java Server Socket, Reading Content From DataInputStream?

Apr 21, 2012

So I have set up a basic client/server connection and I am trying to send a message to one another on connection, I got the client to receive the message from the server, but the server doesn't recieve the clients message. Here is my current code for reading the sent data from the client:

ServerThread.socket = new ServerSocket(5556);
Socket client = ServerThread.socket.accept();
DataInputStream in = new DataInputStream

[code]....

View 2 Replies

TCP Client Error While Reading Data From Socket Server?

Apr 20, 2012

I have a TCP Socket Client (using the Socket Class) that is connected to a simple TCP socket server (just for testing)I have this code snippet :

Dim aSocket as Socket
While aSocket.Connected = True
byteRead = aSocket.Receive(dataByte) 'number of bytes

[code].....

View 1 Replies

TCP Server Not Reading From Socket Untill Objects Disposed?

Nov 24, 2009

Please excuse my choice of wording and/or mixup of terms, I am a dummy when it comes to socket programming. I am trying to connect to a TCP server, write a message and process a response. I use the following code:

Dim tcpClient As Sockets.TcpClient = New TcpClient()
tcpClient.Connect(hostname, 9080)
Dim networkStream As NetworkStream = tcpClient.GetStream()

[code].....

View 1 Replies

VS 2010 Socket Chat Is Not Receiving On Java Server

Aug 17, 2011

I am making a java chat server, and a guy was able to connect to it no problem (however, he logged off for the night before I ran into any problems, so I couldn't see what he did). Here is my code on the VB form:

[Code]....

View 5 Replies

MDI Application Getting Closed?

Feb 21, 2012

I have the following snippet in the load event of a MDI child:

Try
foApplRole =
New ApplRole
ugRegionUser.DisplayLayout.Bands(0).Columns(
"User_ID_C").ValueList = uddUser

[Code]...

View 1 Replies

Connection's Current State Is Closed - Connect To Sql Server And Display A Record

Jun 21, 2010

I am a ASP Classic Programmer, professionally for a little over a year, I have developed some rather nice sites, including the one in my signature (Still a work in progress).

I have been forced to use ASP.NET (VB) for a FileUpload control, as it offers a self controlled way of creating Thumbnails, without the use of 3rd party controls, which is great, as my hosting server does not allow for 3rd party installs on their servers.
So.

The code below is what I have so far for connecting to the database and displaying a record is the "cookie" exist on the users computer.

Unfortunantly, this is not working, and to be honest with you, their is not a whole lot of resources available to show how to do this correctly.

So I am stuck with a lot of post and hoping that someone can actually assist me with this and tell me what I am doing wrong and maybe correct my code.

I am getting an error about the "Connection is closed"

If you want to re-write my code, I prefer something simple and basic, as the only thing that I am doing to checking rather the user is logged in, and if so, display a record from the database. I am NOT in the need for the DataGrid, so please do not suggest it, as I am only needing to check this one thing.

I would like to also add, that I have successfully contect to my database with the FileUpload control and save file names of the images uploaded, so I know that my connection string is done properly> But, for some reason the "SELECT" statement is causing a HUGE issue. (It was easier to insert, than to select, I am not use to that)

CODE:

View 4 Replies

Specific Cast Is Not Valid In Client Server Socket Program

Jun 14, 2012

I am Working on Teghax Component.Using This Component we want to find out Block title attribute of dwg file in a client server socket application.

1> We get Block title attributes properly of dwg file in windows application form using the getattribute function().

2> We get Block title Attributes properly in that way:-We take a class library where we take a class.in this class we use getattribute function().Then We access the particular class from another project

But when we use the same class(Keep same structure) in client server socket program.Then it gives an exception.i.e ,"Spaicfied cast is not valid"I am Not getting any reply form teghax developer..I attached exception screen sort.Give me Suggestion How to solve this Exception

Code given Bellow :

Public Function Get_DwgFileAttribute(ByVal Sender As ClsTcpConnection, ByVal msgTag As Byte, ByVal message As String) As String
Dictionary = GetHashtable(message)
Dim varfilepath As String = CStr(Dictionary.Item("filePath"))

[code]....

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved