Click here to Skip to main content
15,895,667 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Help with array code Pin
Solid Snake5-Apr-06 6:56
Solid Snake5-Apr-06 6:56 
Questionvb to vb.net Pin
machman13-Apr-06 13:08
machman13-Apr-06 13:08 
AnswerRe: vb to vb.net Pin
Christian Graus3-Apr-06 15:06
protectorChristian Graus3-Apr-06 15:06 
AnswerRe: vb to vb.net Pin
Chatura Dilan3-Apr-06 15:16
Chatura Dilan3-Apr-06 15:16 
QuestionDatagrid - Reload data - Timer? Pin
NewbieDave3-Apr-06 11:36
NewbieDave3-Apr-06 11:36 
AnswerRe: Datagrid - Reload data - Timer? Pin
Christian Graus3-Apr-06 15:37
protectorChristian Graus3-Apr-06 15:37 
Questionarray with listview Pin
calmeat3-Apr-06 9:16
calmeat3-Apr-06 9:16 
QuestionTCPListener.socket closes on send Pin
Bertymas3-Apr-06 8:25
Bertymas3-Apr-06 8:25 
I'm using VB in VS2005 on a WXP SP2 machine to build a windows service that listens to a port to accept messages. This solution works fine when a connecting client sends a message, waits for an ACK and disconnects. We now want the socket to remain OPEN after sending the ACK, which it used to do on beta2 and older machines.

Does anyone know which property to set or another solution to keep the socket open after the send.

Any ideas?

Bert Maes

Here's the code:

Public Sub StartGateway()
CommServerListener = New TcpListener(IPAddress.Parse(HostIpAddress), CommServerUnsollicitedPort)
CommServerListener.Start()
Timer2 = New System.Timers.Timer(1000)
Timer2.Enabled = True
End Sub

Public Sub Timer2_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles Timer2.Elapsed
If h.CommServerListener.Pending() Then
Timer2.Enabled = False
ProcessCloverleafRequest()
Timer2.Enabled = True
End If
End Sub
Public Sub ProcessCloverleafRequest()
Dim Buffer As Byte() = New Byte(TcpBufferSize) {}
Dim NumberOfBytes As Integer
Dim Temp As String
Dim msg As String
Dim iStart, iEnd As Integer
If ListenerSocket Is Nothing Then
ListenerSocket = CommServerListener.AcceptSocket
End If
Temp = String.Empty
If ListenerSocket.Available > 0 Then
ReDim Buffer(ListenerSocket.Available)
NumberOfBytes = CInt(ListenerSocket.Available)
ListenerSocket.Receive(Buffer, Buffer.Length, SocketFlags.None)
If NumberOfBytes > 0 Then
'....do stuff
'when finished echo message
ListenerSocket.Send(Buffer, 0, Buffer.Length, SocketFlags.none)
'Here one would expect that this instruction doesn't close the connection
'anyway the connection should stay open
End Sub
Questionaspx web pages.......... Pin
daviiie3-Apr-06 7:40
daviiie3-Apr-06 7:40 
AnswerRe: aspx web pages.......... Pin
daviiie3-Apr-06 8:09
daviiie3-Apr-06 8:09 
GeneralRe: aspx web pages.......... Pin
simonwhale3-Apr-06 10:36
simonwhale3-Apr-06 10:36 
GeneralRe: aspx web pages.......... Pin
daviiie3-Apr-06 10:40
daviiie3-Apr-06 10:40 
GeneralRe: aspx web pages.......... Pin
machman13-Apr-06 14:29
machman13-Apr-06 14:29 
GeneralRe: aspx web pages.......... Pin
FrankyT5-Apr-06 13:52
FrankyT5-Apr-06 13:52 
QuestionConverting international date formats Pin
Jeanne Dixon3-Apr-06 6:52
Jeanne Dixon3-Apr-06 6:52 
Questionregister ocx at .net 2003 Pin
SVb.net3-Apr-06 5:55
SVb.net3-Apr-06 5:55 
AnswerRe: register ocx at .net 2003 Pin
FrankyT5-Apr-06 13:42
FrankyT5-Apr-06 13:42 
Questionregister ocx at .net 2003 Pin
SVb.net3-Apr-06 5:54
SVb.net3-Apr-06 5:54 
Questionregister ocx at .net 2003 Pin
SVb.net3-Apr-06 5:52
SVb.net3-Apr-06 5:52 
Questionocx Pin
SVb.net3-Apr-06 5:11
SVb.net3-Apr-06 5:11 
QuestionHow do I capture my network userid and display it on a form? Pin
Rashar3-Apr-06 4:03
Rashar3-Apr-06 4:03 
AnswerRe: How do I capture my network userid and display it on a form? Pin
KreativeKai3-Apr-06 5:27
professionalKreativeKai3-Apr-06 5:27 
GeneralRe: How do I capture my network userid and display it on a form? Pin
Rashar3-Apr-06 5:52
Rashar3-Apr-06 5:52 
GeneralRe: How do I capture my network userid and display it on a form? Pin
KreativeKai4-Apr-06 8:28
professionalKreativeKai4-Apr-06 8:28 
GeneralRe: How do I capture my network userid and display it on a form? Pin
FrankyT5-Apr-06 13:48
FrankyT5-Apr-06 13:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.