Click here to Skip to main content
15,908,834 members

Comments by Aduu (Top 1 by date)

Aduu 1-Jul-12 3:23am View    
Actually there is a system running as a server which is further making connectinos with sub systems we call them test system. First we need to make a connection with the server by giving IP address and Port which I am doing using tcpclnt.connect. After that I need to send a string to that server with that subsytem name with which I want to connect ( This will be entered by user on run time). Clicking on connect button will make a connection with server and send this string to server. Once we send this string to server, it will make a connection with that system and then we can send messages further.

Now user may want to change this sub system after some time, so they can click on Disconnect button, that sould drop current connection and then can re-enter another system name and click connent. Which should make a connection with server and then with that sub system. But in my case its giving following error on tcpclnt.connect line. First time I click on connect button its working, but if I click it after clicking Disconnect, its giving follwoing error.

System.Net.Sockets.SocketException was unhandled
Message=A connect request was made on an already connected socket
Source=System
ErrorCode=10056
NativeErrorCode=10056
StackTrace:
at System.Net.Sockets.TcpClient.Connect(String hostname, Int32 port)
at MAxx_Test_Tools.Cxxx.Connect_Click(Object sender, EventArgs e) in C:\Users\agoya3\Documents\Visual Studio 2010\Projects\MACS Test Tools\MAXX Test Tools\CXXX.cs:line 41
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at MACS_Test_Tools.Program.Main() in c:\users\agoya3\documents\visual studio 2010\Projects\MACS Test Tools\MAXX Test Tools\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: