TCP reconnect to server
Hi!
I would like to do smoething that is explained here:
http://www.ni.com/example/28039/en/
Altough the files is to old for my LabView 2014 so I can not take a look into those files. But I would like my client to reconnect to the server if the server for some reasone die for a couple of minutes. I tried to do a while loop which containde both the reding while loop and TCP Open Connection. But it seems to be overflow when starting the server again (error code 63). Any ideas?
The Simple TCP Example server is not a good example for what you want to do. The server has to be able to detect that the client disconnected and go back into listen (waiting) mode for new incoming connections.
If you look in Example Finder for TCP examples you should take a closer look at Data Server.vi (allowing only one simultanous connection at the same time) or one of the other two DataServerUsingReentrantRun.vi or DataServerUsingStartAsynchronousCall.vi to see a server architecture that allows a client to disconnect on error an then reconnect.
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions
Similar Messages
-
Hello. I would like to write async tcp client and server. I wrote this code but a have a problem, when I call the disconnect method on client or stop method on server. I can't identify that the client or the server is no longer connected.
I thought I will get an exception if the client or the server is not available but this is not happening.
private async void Process()
try
while (true)
var data = await this.Receive();
this.NewMessage.SafeInvoke(Encoding.ASCII.GetString(data));
catch (Exception exception)
How can I determine that the client or the server is no longer available?
Server
public class Server
private readonly Dictionary<IPEndPoint, TcpClient> clients = new Dictionary<IPEndPoint, TcpClient>();
private readonly List<CancellationTokenSource> cancellationTokens = new List<CancellationTokenSource>();
private TcpListener tcpListener;
private bool isStarted;
public event Action<string> NewMessage;
public async Task Start(int port)
this.tcpListener = TcpListener.Create(port);
this.tcpListener.Start();
this.isStarted = true;
while (this.isStarted)
var tcpClient = await this.tcpListener.AcceptTcpClientAsync();
var cts = new CancellationTokenSource();
this.cancellationTokens.Add(cts);
await Task.Factory.StartNew(() => this.Process(cts.Token, tcpClient), cts.Token, TaskCreationOptions.LongRunning, TaskScheduler.Default);
public void Stop()
this.isStarted = false;
foreach (var cancellationTokenSource in this.cancellationTokens)
cancellationTokenSource.Cancel();
foreach (var tcpClient in this.clients.Values)
tcpClient.GetStream().Close();
tcpClient.Close();
this.clients.Clear();
public async Task SendMessage(string message, IPEndPoint endPoint)
try
var tcpClient = this.clients[endPoint];
await this.Send(tcpClient.GetStream(), Encoding.ASCII.GetBytes(message));
catch (Exception exception)
private async Task Process(CancellationToken cancellationToken, TcpClient tcpClient)
try
var stream = tcpClient.GetStream();
this.clients.Add((IPEndPoint)tcpClient.Client.RemoteEndPoint, tcpClient);
while (!cancellationToken.IsCancellationRequested)
var data = await this.Receive(stream);
this.NewMessage.SafeInvoke(Encoding.ASCII.GetString(data));
catch (Exception exception)
private async Task Send(NetworkStream stream, byte[] buf)
await stream.WriteAsync(BitConverter.GetBytes(buf.Length), 0, 4);
await stream.WriteAsync(buf, 0, buf.Length);
private async Task<byte[]> Receive(NetworkStream stream)
var lengthBytes = new byte[4];
await stream.ReadAsync(lengthBytes, 0, 4);
var length = BitConverter.ToInt32(lengthBytes, 0);
var buf = new byte[length];
await stream.ReadAsync(buf, 0, buf.Length);
return buf;
Client
public class Client
private TcpClient tcpClient;
private NetworkStream stream;
public event Action<string> NewMessage;
public async void Connect(string host, int port)
try
this.tcpClient = new TcpClient();
await this.tcpClient.ConnectAsync(host, port);
this.stream = this.tcpClient.GetStream();
this.Process();
catch (Exception exception)
public void Disconnect()
try
this.stream.Close();
this.tcpClient.Close();
catch (Exception exception)
public async void SendMessage(string message)
try
await this.Send(Encoding.ASCII.GetBytes(message));
catch (Exception exception)
private async void Process()
try
while (true)
var data = await this.Receive();
this.NewMessage.SafeInvoke(Encoding.ASCII.GetString(data));
catch (Exception exception)
private async Task Send(byte[] buf)
await this.stream.WriteAsync(BitConverter.GetBytes(buf.Length), 0, 4);
await this.stream.WriteAsync(buf, 0, buf.Length);
private async Task<byte[]> Receive()
var lengthBytes = new byte[4];
await this.stream.ReadAsync(lengthBytes, 0, 4);
var length = BitConverter.ToInt32(lengthBytes, 0);
var buf = new byte[length];
await this.stream.ReadAsync(buf, 0, buf.Length);
return buf;Hi,
Have you debug these two applications? Does it go into the catch exception block when you close the client or the server?
According to my test, it will throw an exception when the client or the server is closed, just log the exception message in the catch block and then you'll get it:
private async void Process()
try
while (true)
var data = await this.Receive();
this.NewMessage.Invoke(Encoding.ASCII.GetString(data));
catch (Exception exception)
Console.WriteLine(exception.Message);
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
By the way, I don't know what the SafeInvoke method is, it may be an extension method, right? I used Invoke instead to test it.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Problems Running a TCP/IP Data Server VI as a Windows XP service
I need to run a TCP/IP data server as a Windows service. As my first step, I modified the LabVIEW example "Multiple Connections - Server.vi" under the TCP.llb to eliminate all controls with constants. I can run succesfully the VI under the LabVIEW environment and get the data from other computers in the network using the "Multiple Connections - Client 1.vi"
After read and followed the instructions posted in the document "Creating a Windows NT Service Using LabVIEW", I was able to create the Windows XP service. The "task manager" shows it running. A freeware Etherenet port monitor shows it listening. When I try running my client, the port monitor shows a connection being established but after few seconds goes into a "time_wait" state and stays there. End result: the client does not get the data.
Any hints will be highly appreciated!
Attachments:
RadMon_DataServer.vi 41 KBHola buen día,
Para darte una mejor solución podrías decirnos que aplicación estás tratando de hacer?. Que versión de Labview tienes?
Saludos,
NorSa
NI Applications Engineer Latin America
Para Soporte entra aquí -
ITunes takes 90 seconds to load due to TCP Reconnects
iTunes takes about 90 seconds to load on my Windows 7 machine - a VERY fast machine with 6GB RAM and SSD drive where all other apps run very fast. Scanning the internet, I found many instances of extremely slow loading, but none of the suggestions were helpful. So, I used Process Monitor to see what the f*ck iTunes is doing...
It turns out that iTunes is hanging due to TCP Reconnects. It appears to be scanning TCP ports in the range of 61432 to 61503, trying each one twice, and each attempt takes 500 ms to time-out, causing a total of a 71 second hang during startup. As appears to be typical for this very poorly behaved software, all of this occurs before any UI has been drawn - not even a splash screen - making things all the more confusing for the poor user, who is left wondering why the heck the program doesn't appear to have launched.
I realize that this is probably not occurring for all users, meaning that there is something different about the installation/config on my particular machine that is triggering this problem. Still, that is no excuse for such ridiculous behavior, especially for such a widely used application.
Any help with this problem would be much appreciated. Although, I'm not really interested in the obligatory shotgun approaches of things like doing full uninstall/re-install of iTunes and/or Windows 7, etc. So, thank you for not asking me to do things that are likely to be a huge waste of my valuable time. If you want me to capture and post details about my machine, I'll do that - even though it's highly obvious that this is an ugly software problem in iTunes that needs to be fixed.FYI, the TCP Reconnects are shown as MachineName:61xxx -> MachineName:5354, and the result of the API call is SUCCESS. I'm just assuming they're timing out since the API calls are 500 ms apart. I have no idea what this API is doing exactly, or why it seems to be scanning a range of ports but with each connection then apparently going to port 5354. Very strange. There are no other API calls in between the TCP Reconnect. Picture is attached:
calls. -
My Indesign Link File missing source when reconnect my server, anyone can help me?
My Indesign Link File missing source when reconnect my server, anyone can help me?
I am Using Mini Mac, OS X 10.8, but my server is using Window serverDid the server name change, or the drive letter assigned to it?
-
I have the labview TCP/IP client/server working fine, but now I need to do this were labview is the TCP/IP server and the c++ program is the client. Does anybody have a simple C++ TCP/IP client that works with labview TCP/IP server ????
Thanks, you were right, we modified the c++ program to include the port # in the IP address and it worked.We also forgot to convert the port #. I included my labview and c++ program.
Attachments:
TCP-IP.llb 47 KB
client.exe 40 KB -
How to list IP address from client on the Server (TCP/IP CLIENT SERVER COMMUNICATION)
Excuse me,
In this project I want to ask how to add list IP from client that connect to server.
I have edited slightly the project.
'SERVER
Imports System.Net
Imports System.Net.Sockets
Imports System.Threading
Imports System.Threading.Tasks
Imports System.Reflection
Public Class ServerForm
Private _Listener As TcpListener
Private _Connections As New List(Of ConnectionInfo)
Private _ConnectionMonitor As Task
Private Sub Button_Checked(sender As System.Object, e As System.EventArgs) Handles StartStopButton.CheckedChanged
If StartStopButton.Checked Then
StartStopButton.Text = "Stop"
StartStopButton.Image = My.Resources.StopServer
_Listener = New TcpListener(IPAddress.Any, CInt(PortTextBox.Text))
_Listener.Start()
Dim monitor As New MonitorInfo(_Listener, _Connections)
ListenForClient(monitor)
_ConnectionMonitor = Task.Factory.StartNew(AddressOf DoMonitorConnections, monitor, TaskContinuationOptions.LongRunning)
Else
StartStopButton.Text = "Start:"
StartStopButton.Image = My.Resources.StartServer
CType(_ConnectionMonitor.AsyncState, MonitorInfo).Cancel = True
_Listener.Stop()
_Listener = Nothing
End If
End Sub
Private Sub PortTextBox_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles PortTextBox.Validating
Dim deltaPort As Integer
If Not Integer.TryParse(PortTextBox.Text, deltaPort) OrElse deltaPort < 1 OrElse deltaPort > 65535 Then
MessageBox.Show("Port number between 1 and 65535", "Invalid Port Number", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
PortTextBox.SelectAll()
e.Cancel = True
End If
End Sub
Private Sub ListenForClient(monitor As MonitorInfo)
Dim info As New ConnectionInfo(monitor)
_Listener.BeginAcceptTcpClient(AddressOf DoAcceptClient, info)
End Sub
Private Sub DoAcceptClient(result As IAsyncResult)
Dim monitorinfo As MonitorInfo = CType(_ConnectionMonitor.AsyncState, MonitorInfo)
If monitorinfo.Listener IsNot Nothing AndAlso Not monitorinfo.Cancel Then
Dim info As ConnectionInfo = CType(result.AsyncState, ConnectionInfo)
monitorinfo.Connections.Add(info)
info.AcceptClient(result)
ListenForClient(monitorinfo)
info.AwaitData()
Dim doUpdateConnectionCountLabel As New Action(AddressOf UpdateConnectionCountLabel)
Invoke(doUpdateConnectionCountLabel)
End If
End Sub
Private Sub DoMonitorConnections()
Dim doAppendOutput As New Action(Of String)(AddressOf AppendOutput)
Dim doUpdateConnectionCountLabel As New Action(AddressOf UpdateConnectionCountLabel)
Dim monitorInfo As MonitorInfo = CType(_ConnectionMonitor.AsyncState, MonitorInfo)
Me.Invoke(doAppendOutput, "Server Started")
Do
Dim lostCount As Integer = 0
For index As Integer = monitorInfo.Connections.Count - 1 To 0 Step -1
Dim info As ConnectionInfo = monitorInfo.Connections(index)
If info.Client.Connected Then
If info.DataQueue.Count > 0 Then
Dim messageBytes As New List(Of Byte)
While info.DataQueue.Count > 0
Dim value As Byte
If info.DataQueue.TryDequeue(value) Then
messageBytes.Add(value)
End If
End While
Me.Invoke(doAppendOutput, "Message from IP: " + System.Text.Encoding.ASCII.GetString(messageBytes.ToArray))
End If
Else
monitorInfo.Connections.Remove(info)
lostCount += 1
End If
Next
If lostCount > 0 Then
Invoke(doUpdateConnectionCountLabel)
End If
_ConnectionMonitor.Wait(1)
Loop While Not monitorInfo.Cancel
For Each info As ConnectionInfo In monitorInfo.Connections
info.Client.Close()
Next
monitorInfo.Connections.Clear()
Invoke(doUpdateConnectionCountLabel)
Me.Invoke(doAppendOutput, "Server Stoped")
End Sub
Private Sub UpdateConnectionCountLabel()
ConnectionCountLabel.Text = String.Format("{0} Connections", _Connections.Count)
End Sub
Private Sub AppendOutput(message As String)
If RichTextBox1.TextLength > 0 Then
RichTextBox1.AppendText(ControlChars.NewLine)
End If
RichTextBox1.AppendText(message)
RichTextBox1.ScrollToCaret()
End Sub
Private Sub ClearButton_Checked(sender As Object, e As EventArgs) Handles ClearButton.CheckedChanged
If ClearButton.Checked Then
RichTextBox1.Clear()
End If
End Sub
End Class
Public Class MonitorInfo
Private _listener As TcpListener
Public ReadOnly Property Listener As TcpListener
Get
Return _listener
End Get
End Property
Private _connections As List(Of ConnectionInfo)
Public ReadOnly Property Connections As List(Of ConnectionInfo)
Get
Return _connections
End Get
End Property
Public Property Cancel As Boolean
Public Sub New(tcpListener As TcpListener, connectionInfoList As List(Of ConnectionInfo))
_listener = tcpListener
_connections = connectionInfoList
End Sub
End Class
Public Class ConnectionInfo
Private _monitor As MonitorInfo
Public ReadOnly Property Monitor As MonitorInfo
Get
Return _monitor
End Get
End Property
Private _Client As TcpClient
Public ReadOnly Property Client As TcpClient
Get
Return _Client
End Get
End Property
Private _DataQueue As System.Collections.Concurrent.ConcurrentQueue(Of Byte)
Public ReadOnly Property DataQueue As System.Collections.Concurrent.ConcurrentQueue(Of Byte)
Get
Return _DataQueue
End Get
End Property
Private _Stream As NetworkStream
Public ReadOnly Property Stream As NetworkStream
Get
Return _Stream
End Get
End Property
Public Sub New(monitor As MonitorInfo)
_monitor = monitor
_DataQueue = New System.Collections.Concurrent.ConcurrentQueue(Of Byte)
End Sub
Private _LastReadLength As Integer
Public ReadOnly Property LastReadLength As Integer
Get
Return _LastReadLength
End Get
End Property
Private _Buffer(63) As Byte
Public Sub AcceptClient(result As IAsyncResult)
_Client = _monitor.Listener.EndAcceptTcpClient(result)
If _Client IsNot Nothing AndAlso _Client.Connected Then
_Stream = _Client.GetStream
End If
End Sub
Public Sub AwaitData()
_Stream.BeginRead(_Buffer, 0, _Buffer.Length, AddressOf DoReadData, Me)
End Sub
Private Sub DoReadData(result As IAsyncResult)
Dim info As ConnectionInfo = CType(result.AsyncState, ConnectionInfo)
Try
If info.Stream IsNot Nothing AndAlso info.Stream.CanRead Then
info._LastReadLength = info.Stream.EndRead(result)
For Index As Integer = 0 To _LastReadLength - 1
info._DataQueue.Enqueue(info._Buffer(Index))
Next
'info.SendMessage("Data Diterima " & info._LastReadLength & " Bytes")
info.SendMessage("reply form server: " & info._LastReadLength & " Bytes")
For Each otherInfo As ConnectionInfo In info.Monitor.Connections
If Not otherInfo Is info Then
otherInfo.SendMessage(System.Text.Encoding.ASCII.GetString(info._Buffer))
End If
Next
info.AwaitData()
Else
info.Client.Close()
End If
Catch ex As Exception
info._LastReadLength = -1
End Try
End Sub
Private Sub SendMessage(message As String)
If _Stream IsNot Nothing Then
Dim messageData() As Byte = System.Text.Encoding.ASCII.GetBytes(message)
Stream.Write(messageData, 0, messageData.Length)
End If
End Sub
End Class
'CLIENT
Imports System.Net
Imports System.Net.Sockets
Public Class ClientForm
Private _Connection As ConnectionInfo
Private _ServerAddress As IPAddress
Private Sub ClientForm_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
ValidateChildren()
End Sub
Private Sub ConnectButton_Checked(sender As Object, e As System.EventArgs) Handles ConnectButton.CheckedChanged
If ConnectButton.Checked Then
If _ServerAddress IsNot Nothing Then
ConnectButton.Text = "Disconnect"
ConnectButton.Image = My.Resources.StopServer
Try
_Connection = New ConnectionInfo(_ServerAddress, CInt(PortTextBox.Text), AddressOf InvokeAppendOutput)
_Connection.AwaitData()
Catch ex As Exception
MessageBox.Show(ex.Message, "Error Connecting to Server", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
ConnectButton.Checked = False
End Try
Else
MessageBox.Show("Invlid IP Server", "Cannt Connect to Server", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
ConnectButton.Checked = False
End If
Else
ConnectButton.Text = "Connect"
ConnectButton.Image = My.Resources.StartServer
If _Connection IsNot Nothing Then _Connection.Close()
_Connection = Nothing
End If
End Sub
Private Sub SendButton_Click(sender As System.Object, e As System.EventArgs) Handles SendButton.Click
If _Connection IsNot Nothing AndAlso _Connection.Client.Connected AndAlso _Connection.Stream IsNot Nothing Then
Dim buffer() As Byte = System.Text.Encoding.ASCII.GetBytes(InputTextBox.Text)
_Connection.Stream.Write(buffer, 0, buffer.Length)
End If
End Sub
Private Sub ServerTextBox_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles IPTextBox.Validating
_ServerAddress = Nothing
Dim remoteHost As IPHostEntry = Dns.GetHostEntry(IPTextBox.Text)
If remoteHost IsNot Nothing AndAlso remoteHost.AddressList.Length > 0 Then
For Each deltaAddress As IPAddress In remoteHost.AddressList
If deltaAddress.AddressFamily = AddressFamily.InterNetwork Then
_ServerAddress = deltaAddress
Exit For
End If
Next
End If
If _ServerAddress Is Nothing Then
MessageBox.Show("Cannot resolve Server Address", "invalid Server", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
IPTextBox.SelectAll()
e.Cancel = True
End If
End Sub
Private Sub PortTextBox_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles PortTextBox.Validating
Dim deltaPort As Integer
If Not Integer.TryParse(PortTextBox.Text, deltaPort) OrElse deltaPort < 1 OrElse deltaPort > 65535 Then
MessageBox.Show("Port number between 1 and 65535", "invalid Port number", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
PortTextBox.SelectAll()
e.Cancel = True
End If
End Sub
Private Sub InvokeAppendOutput(message As String)
Dim doAppendOutput As New Action(Of String)(AddressOf AppendOutput)
Me.Invoke(doAppendOutput, message)
End Sub
Private Sub AppendOutput(message As String)
If RichTextBox1.TextLength > 0 Then
RichTextBox1.AppendText(ControlChars.NewLine)
End If
RichTextBox1.AppendText(message)
RichTextBox1.ScrollToCaret()
End Sub
Private Sub ButtonClear_Click(sender As Object, e As EventArgs) Handles ButtonClear.Click
RichTextBox1.Clear()
InputTextBox.Clear()
End Sub
End Class
Public Class ConnectionInfo
Private _AppendMethod As Action(Of String)
Public ReadOnly Property AppendMethod As Action(Of String)
Get
Return _AppendMethod
End Get
End Property
Private _Client As TcpClient
Public ReadOnly Property Client As TcpClient
Get
Return _Client
End Get
End Property
Private _Stream As NetworkStream
Public ReadOnly Property Stream As NetworkStream
Get
Return _Stream
End Get
End Property
Private _LastReadLength As Integer
Public ReadOnly Property LastReadLength As Integer
Get
Return _LastReadLength
End Get
End Property
Private _Buffer(63) As Byte
Public Sub New(address As IPAddress, port As Integer, append As Action(Of String))
_AppendMethod = append
_Client = New TcpClient
_Client.Connect(address, port)
_Stream = _Client.GetStream
End Sub
Public Sub AwaitData()
_Stream.BeginRead(_Buffer, 0, _Buffer.Length, AddressOf DoreadData, Me)
End Sub
Public Sub Close()
If _Client IsNot Nothing Then _Client.Close()
_Client = Nothing
_Stream = Nothing
End Sub
Private Sub DoreadData(result As IAsyncResult)
Dim info As ConnectionInfo = CType(result.AsyncState, ConnectionInfo)
Try
If info._Stream IsNot Nothing AndAlso info._Stream.CanRead Then
info._LastReadLength = info._Stream.EndRead(result)
If info._LastReadLength > 0 Then
Dim message As String = System.Text.Encoding.ASCII.GetString(info._Buffer)
info._AppendMethod(message)
End If
info.AwaitData()
End If
Catch ex As Exception
info._LastReadLength = -1
info._AppendMethod(ex.Message)
End Try
End Sub
End Class
//ScreenShot server
http://prntscr[dot]com/5t1ol3
//Screenshot client
http://prntscr[dot]com/5t1odj
source: code[dot]msdn[dot]microsoft[dot]com/windowsdesktop/Simple-Multi-User-TCPIP-43cc3b44I have a similar chat application. When the user attempts to connect, instead of sending a simple string, the client sends a serialized object(xml string) with all relevant login and session information, this includes the user's IP address. Once the server
receives said information, depending on the type of TCP broadcast (a custom enumerated type) information from one user may be passed to a single user, or distributed to many users.
If it helps, here is the TCPBroadcast object I use. But in order for your server to understand it, you kind of have to build your server and client somewhat around it.
Option Strict On
Option Explicit On
Option Infer Off
Namespace TCPChat
Public Class TCPBroadcast
Public Property Message As String
Public Property BroadCastTime As DateTime
Public Property DestUser As String
Public Property OriginUser As String
Public Property PasswordHash As String
Public Property BroadcastSourceIP As String
Public Property BroadCastType As TCPBroadcastType
Public Property LoginUserName As String
Public Property FailureReason As String
Public Function XmlEncoding() As String
Dim serializer As New Xml.Serialization.XmlSerializer(GetType(TCPBroadcast))
Dim XML As String = String.Empty
Using memStream As New IO.MemoryStream
Using xmlWriter As New Xml.XmlTextWriter(memStream, System.Text.Encoding.UTF8) With _
{.Indentation = 4, .Formatting = System.Xml.Formatting.Indented}
serializer.Serialize(xmlWriter, Me)
End Using
XML = System.Text.Encoding.UTF8.GetString(memStream.ToArray)
End Using
Return XML
End Function
Public Function ToBinary() As Byte()
Return System.Text.Encoding.UTF8.GetBytes(Me.XmlEncoding)
End Function
Public Shared Function FromBinary(binary As Byte()) As DeserializationResult
Dim xml As String = System.Text.Encoding.UTF8.GetString(binary)
Return FromXML(xml)
End Function
Public Shared Function FromXML(xml As String) As DeserializationResult
Dim DeserializationResult As New DeserializationResult
DeserializationResult.Error = False
Try
Dim deserializer As New Xml.Serialization.XmlSerializer(GetType(TCPBroadcast))
Dim buffer As Byte() = System.Text.Encoding.UTF8.GetBytes(xml)
Using memStream As New IO.MemoryStream(buffer)
DeserializationResult.tcpBroadCast = CType(deserializer.Deserialize(memStream), TCPBroadcast)
End Using
Catch ex As Exception
DeserializationResult.Error = True
DeserializationResult.ErrorMessage = ex.ToString
DeserializationResult.AttemptedXML = xml
End Try
Return DeserializationResult
End Function
Public Class DeserializationResult
Public [Error] As Boolean
Public ErrorMessage As String
Public tcpBroadCast As TCPBroadcast
Public AttemptedXML As String
Sub New()
End Sub
End Class
Public Enum TCPBroadcastType
AdministrativeMessage
AuthenticationFailure
AuthenticationSuccess
ChatBroadcast
CredentialsRequest
Credentials
DisconnectedByServer
KeepAlive
PrivateMessage
ServerMessage
SystemMessage
UnableToProcessRequest
End Enum
End Class
End Namespace
“If you want something you've never had, you need to do something you've never done.”
Don't forget to mark
helpful posts and answers
! Answer an interesting question? Write a
new article
about it! My Articles
*This post does not reflect the opinion of Microsoft, or its employees. -
Reconnecting macmini server 2009
Since I moved my apartment and got a new ISP, I am unable to connect to my mac mini server.
Mac Mini is connected to my Airport WIFI and the TA/Modem but can't access using my Imac nor
mac book pro.
Please help.
Thank you,
AHello,
Make a New Location, Using network locations in Mac OS X ...
http://support.apple.com/kb/HT2712
10.7…
System Preferences>Network, top of window>Locations>Edit Locations, little plus icon, give it a name.
10.5.x/10.6.x/10.7.x instructions...
System Preferences>Network, click on the little gear at the bottom next to the + & - icons, (unlock lock first if locked), choose Set Service Order.
The interface that connects to the Internet should be dragged to the top of the list.
Instead of joining your Network from the list, click the WiFi icon at the top, and click join other network. Fill in everything as needed.
Try turning off IPv6:
System Preferences » Network » AirPort » TCP/IP tab » Configure IPv6
Or for whatever Interface you use. -
NFS shares fail to reconnect after server is rebooted
Hi everyone,
I currently have a File Sharing/Media Box/Torrent/Newgroup box in my basement/theater room. It is basically running as my server for the house. Consequently I have a bunch of NFS shares on it. Previously I was running Ubuntu on a similar box and didn't have this issue. What is happening is that if I reboot the server for whatever reason, the clients do not reconnect to the shares once the server box has rebooted. When I was running Ubuntu, after reboot the shares would just automagically be reconnected.
Both boxes are running Arch Linux if it matters.
Here is the /etc/exports file on the server:
# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5).
/media/video/dlvideo/ 192.168.X.X/24(rw,async,no_subtree_check,no_root_squash)
/media/video/DVD/ 192.168.X.X/24(rw,async,no_subtree_check,no_root_squash)
/media/video/HDVID/ 192.168.X.X/24(rw,async,no_subtree_check,no_root_squash)
/media/stuff/AudioBooks/ 192.168.X.X/24(rw,async,no_subtree_check,no_root_squash)
/media/stuff/Downloads/ 192.168.X.X/24(rw,async,no_subtree_check,no_root_squash)
/media/stuff/Music/ 192.168.X.X/24(rw,async,no_subtree_check,no_root_squash)
/media/mythtv/ 192.168.X.X/24(rw,async,no_subtree_check,no_root_squash)
And here is how I mount them on the client:
192.168.X.X:/media/video/dlvideo /media/video/dlvideo nfs rsize=8192,wsize=8192,timeo=14,intr 0 0
192.168.X.X:/media/video/DVD /media/video/DVD nfs rsize=8192,wsize=8192,timeo=14,intr 0 0
192.168.X.X:/media/video/HDVID /media/video/HDVID nfs rsize=8192,wsize=8192,timeo=14,intr 0 0
192.168.X.X:/media/stuff/Downloads /media/stuff/downloads nfs rsize=8192,wsize=8192,timeo=14,intr 0 0
192.168.X.X:/media/stuff/Music /media/stuff/music nfs rsize=8192,wsize=8192,timeo=14,intr 0 0
192.168.X.X:/media/stuff/AudioBooks /media/stuff/audiobooks nfs rsize=8192,wsize=8192,timeo=14,intr 0 0
192.168.X.X:/media/mythtv /media/mythtv nfs rsize=8192,wsize=8192,timeo=14,intr 0 0
Anyone have any ideas?
Thanks,
KevinHi there,
Have you tried running the SBS specific wizards on your system, namely the Fix my Network wizard and the import trusted certificate tool?
FMNW: http://technet.microsoft.com/en-us/library/cc546095.aspx
Import Trusted Certificate:
http://technet.microsoft.com/en-us/library/cc546059.aspx
I'd start with FMNW, and then try a reboot to test if you're still having issues. If yes, then I'd try importing your certificate with the SBS tool, test again.
After that, you might look at the SBS Best Practices Analyzer results for your server to see if it picks up on a misconfiguration or condition that might be behind this issue.
www.sbsbpa.com
Hope that helps,
-Jason
Jason Miller B.Comm (Hons), MCSA, MCITP, Microsoft MVP -
Some problems to reconnect to server after shutdown server
Hi all,
I have some problems to reconnect to JMS server. (OpenJMS). I have two queues, one to send messages, one to read messages. I implemented ExceptionListener but it's no clear if I must close session and connection or not.
In the onException, can I create a new connection, new session, new QueueReceiver and QueueSender? I'm confused :(.
Thanks in advance,
FedericaI'd recommend you just switch to Apache ActiveMQ (which fully implements JMS 1.1) and which also supports auto-reconnect...
http://incubator.apache.org/activemq/how-can-i-support-auto-reconnection.html
James
http://logicblaze.com/
Open Source SOA -
Client reconnection after Server shutdown
Hi. Can I reconnect a client whose connection has been reset because of a server shutdown to the "new" server (which meanwhile has been started) without restarting the client itself?
Thanks, any help is appreciated.not sure what you mean by 'client' but if you have a Socket that has had any kind of IOException or SocketException you need to close it and create a new one.
-
Java for a tcp high performance server?
I am currently working on a project to design an MMORPG (Massively Multiplayer Online Role Play Game), and the client side code will be written in Blitz3D. I am mainly interested in the server side code, and my preference is to use Java. The server will be multi-threaded, and use tcp and/or udp for communicating with the client.
Anyway, several people have expressed their dislike for my java preference. They say Java is not able to handle such a large scale server. They say java is outdated... They recommend other languages - primarily C++.
Well, I am hoping people here can answer... Can Java handle it?I am currently working on a project to design an
MMORPG (Massively Multiplayer Online Role Play Game),
and the client side code will be written in Blitz3D.
I am mainly interested in the server side code, and
d my preference is to use Java. The server will be
multi-threaded, and use tcp and/or udp for
communicating with the client.
Anyway, several people have expressed their dislike
for my java preference. They say Java is not able to
handle such a large scale server. They say java is
outdated... They recommend other languages -
primarily C++.
Well, I am hoping people here can answer... Can Java
handle it?And has anyone, you included, actually sized the project yet?
What happens with 2,000,000 users downloading 1 meg of data every second? Do you think java by itself can handle that? Do those other people think that C++ by itself can handle that?
And if everyone answers yes to the above then perhaps your group should consider finding someone that has actually worked on a large system before.
Of course if you expect to have 2,000 users downloading 1k of data once a day, then you could use almost any language that you could concieve of to handle it. -
Reconnect to server after uninstalled and then reinstalled?
This is going to sound dumb (it does to me), but I did this none the less and now need help. I installed OS X Lion Server to test out if it would work for what I needed. I went through the intial setup and turned some basic services on. I decided I did not need it, and then uninstalled the app. Well uninstalling the app did not remove the server I had setup so the services that were left on, like File Sharing, are stil "on" and showing everything in Finder as a shared folder.
I figured I could reinstall the server app, reconnect to the server, and then shut the services off. Unfortunately that is not what happened. I was able to reinstall the server app and now the app just sits spinning trying to connect to a server.
Is it possible to reconnect to the original server I created?same issue.
-
Using Modbus TCP I/O Server with new DSC Shared Variables in LabVIEW 8.6
Hello,
I'm using LabVIEW 8.6 and want to communicate with a Beckhoff BK9000 Ethernet TCP/IP Bus Coupler via Modbus TCP. Instead of using the NI Modbus Library, I've tried the new LabVIEW 8.6 feature "DSC Shared Variables" as described at the bottom of this page: Latest NI LabVIEW DSC Module Features and Demos. Reading of analog input bus terminals works fine. However, I haven't figured out yet how to write on an anolog output bus terminal with these shared variables.
It's about a 16 bit analog output and I need to write to the registers 0x1121 and 0x0801. It works with the NI Modbus Library (just using function code 6 and choosing the registers), but on the other hand I don't know which shared variables I have to choose for these registers. I've tried several data items (e.g. 400001 upwards as well as 402049 for 0x0801) but none of them worked. I would be glad for a short explanation - thanks in advance for your support!
Regards
utechleThe Beckhoff documentation says, that holding registers start with 0x0800. I've checked this by using the NI Modbus Library. I used the "MB Ethernet Master Query.vi" togehter with the function code 6 for "Write Single Registers", changed the settings of the starting address to hexadecimal view and entered 801 (since it starts with a control byte in 0x0800 and the data out word follows in 0x0801). Furthermore, I had to address register 0x1121 in the same way for resetting the watchdog. As I've mentioned in my first post, this method works fine. However, I haven't found out yet which shared variables i have to use for accessing these registers.
On the other hand, it's no problem to read data from analog input bus terminals using shared variables. They start with 0x0000 (status byte) and 0x0001 (data in word) and I can read data with the shared variable and data item 300001, respectively.
Message Edited by utechle on 01-27-2009 11:12 PM -
I have a Windows Home Server system that contains all my music and photos.
I have several MACs (all running the latest software) that are set up to automatically connect to this server's specific drives - using system preferences/account/login items.
The server is sent into hibernation each night to conserve power and the mac Mini's that are part of a media center are put to sleep each night.
The shared drives (from the server) are shown on the desktop of the Mini's, but when I open the drive icon I see only the top level folders, opening any folder does not show the files inside.
My Itunes/Iphoto music and images are all on the server - and they do not show up either.
The only way to resolve the issue is to restart the Mini's and then all folders/files are visible.
Any help or suggestions would be much appreciatedAnybody?
Maybe you are looking for
-
Error in Creating the Oracle Fail Safe Group during installation on MSCS
Hi All, I am installing ECC 6 dual stack on MSCS. I have done steps till CI installation as per installation guide. I am gettig the following error in the step "Creating the Oracle fail safe group" while changing physical hostname into the virtual da
-
VS 2005 Project is Broken after trying to register CR 2008 product
I purchased CR 2008 last October, and of course, each time I load a project that has a report in VS 2005, I'm prompted to register the product. Since I am dealing with another CR issue, I felt it was time that I register the product, and start a sup
-
MacBook Pro 13" i7 2011 Freezing when I'm not using it.
I've got the 2011 MacBook Pro 13" i7 with 256GB SSD. It runs really2x fast and am very pleased with it. However, It has a weird issue... It totally freezes when I'm not using it sometimes. It's happened three times now and every time it freezes it wo
-
How do I download my CD's to my IPhone?
how do I download my CD's to my IPhone?
-
No release strategy for service PO
Purchasing document xxxxxxx cannot be released Message no. MEPO823 I created release strategy for service entry sheet through following process. 1. Created three characterstics(service_val, serv_plant & ZSER_DOC TYPE) and assigned it to class 032 (ga