Welcome Guest Search | Active Topics | Members | Log In | Register

Error Creating Listener Options
blackansible
Posted: Wednesday, August 12, 2009 1:24:10 PM
Rank: Member
Groups: Member

Joined: 8/12/2009
Posts: 3
Points: 9
Location: Mexico
I tried to create a pool of sockets in VB.NET using the following code but the listener does not create well (sometimes it does other does not). The pool (class array) is about 700 sockets and it creates 350 listeners aprox. (50% of efficiency) I am using windows 2003 server when this behavior arraise. In the developer workstation it works good. I tried to destroy the class and recreate it again but it does not work. Any idea.

Public Sub StartServer(ByVal IP As String, ByVal Port As Integer)

Dim ep As IPEndPoint
Dim extended As New ExtendedParameters

ep = New IPEndPoint(IPAddress.Parse(IP), Port)
extended.BufferSize = 1024
extended.Optimized = False

Try
listener = Network.AcceptAsync(ep, AddressOf ProcessClient, extended)
Catch ex As Exception
Debug.WriteLine(ex.Message)
mException = ex.Message
End Try
End Sub

Private Sub ProcessClient(ByVal connection As XF.IConnection)
connection.ReadAsync(AddressOf ReadComplete)
End Sub

Private Sub ReadComplete(ByVal connection As XF.IConnection, ByVal buffer As XF.IMemoryBuffer)

If IsNothing(buffer) Then
Exit Sub
End If

' acquire buffer to use it in asynchronous operation
buffer.Acquire()

'-- Convert the buffer to a string
Dim Receive As String = m_Encoding.GetString(buffer.Data, 0, buffer.BytesTransfered)

Debug.Write(Receive)
mConnection.WriteAsync(buffer.Data, buffer.Offset, buffer.BytesTransfered, AddressOf WriteComplete)

buffer.Release()

' continue processing client requests */
ProcessClient(connection)
End Sub


Best regards,

Jorge Reyes
admin
Posted: Wednesday, August 12, 2009 3:17:51 PM
Rank: Administration
Groups: Administration

Joined: 2/15/2008
Posts: 130
Points: 835
Hi Jorge,

What is the reason to create so many listeners? What exactly do you want to implement?
blackansible
Posted: Thursday, August 13, 2009 11:05:54 AM
Rank: Member
Groups: Member

Joined: 8/12/2009
Posts: 3
Points: 9
Location: Mexico
Hi Admin,

We have developed a system to monitor vehicles using gps and each device is a client socket using a dedicated port, therefore the counter part is the socket server hearing (listeners). There are 2 approaches to solve this issue to connect all the devices to one port and the logic identifies each one or the multiport approach. For this project we must use the multiport.

It is very weird because in my development machine (Vista with Visual Studio 2008) the sockets create without problem but when i run in win 2003 the problem is present.

Do you have an advise to follow trying to solve this issue ?
admin
Posted: Thursday, August 13, 2009 4:03:42 PM
Rank: Administration
Groups: Administration

Joined: 2/15/2008
Posts: 130
Points: 835
Jorge,

By default each listener creates a pool of prepared sockets (by 256 until there are at least 1024 sockets).
So you system has used all the resources.

How many simultaneous connections do you get on one listener? Is it just one?

I would suggest to set:
ExtendedParameters.DeltaConnections = 4;
ExtendedParameters.MinimumPreparedConnections = 4;

In this case you will use less resources for each listener and can create more listeners.
blackansible
Posted: Tuesday, August 18, 2009 6:14:03 PM
Rank: Member
Groups: Member

Joined: 8/12/2009
Posts: 3
Points: 9
Location: Mexico
Dear Administrator

I could create my socket with your recommendation. Thank you for your support. I have a doubt because the manual is not ready yet. What is DeltaConnections property intended for ?

Best regards
Jorge Luis
admin
Posted: Wednesday, August 19, 2009 2:12:21 PM
Rank: Administration
Groups: Administration

Joined: 2/15/2008
Posts: 130
Points: 835
DeltaConnections property defines how many connections should be prepared at once.
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFPro Theme Created by Jaben Cargman (Tiny Gecko)
Powered by Yet Another Forum.net version 1.9.1.6 (NET v2.0) - 11/14/2007
Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.
This page was generated in 0.107 seconds.
14 queries (0.033 seconds, 30.84%).

yaf_pageload: 0.014
yaf_topic_info: 0.001
yaf_forum_list: 0.001
yaf_forum_listpath: 0.002
yaf_forum_simplelist: 0.001
yaf_forum_listpath: 0.001
yaf_post_list: 0.004
yaf_usergroup_list: 0.001
yaf_usergroup_list: 0.001
yaf_usergroup_list: 0.001
yaf_usergroup_list: 0.002
yaf_usergroup_list: 0.001
yaf_usergroup_list: 0.001
yaf_active_listtopic: 0.002