darknuke Posted January 9, 2004 Posted January 9, 2004 (edited) Example: Private Sub accept() server = New System.Net.Sockets.TcpListener(txtReceivePort.Text) server.Start() connect = server.AcceptTcpClient connect.GetStream.BeginWrite(convert.toBytes(":: Connected"), 0, System.Text.Encoding.ASCII.GetByteCount(":: Connected"), Nothing, Nothing) End Sub Private Sub somesub() connect.GetStream.BeginWrite(convert.toBytes(":: Received Message"), 0, System.Text.Encoding.ASCII.GetByteCount(":: Received Message"), Nothing, Nothing) End Sub In accept(), it can write to the stream just fine, but when in somesub(), it says 'the instance is not set to an object' when it tries to write. How can I pass the connect object? Edited January 9, 2004 by darknuke Quote This is only a test of the emergency broadcast system This is a product of hysterical mass confusion A ship of fools adrift on the sea of our pollution Rudderless and powerless on the sea of our delusion pennywise - this is only a test
Administrators PlausiblyDamp Posted January 9, 2004 Administrators Posted January 9, 2004 where are you calling somesub from? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
darknuke Posted January 9, 2004 Author Posted January 9, 2004 Private Sub sendMessage_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles sendMessage.KeyPress someSub() End Sub Quote This is only a test of the emergency broadcast system This is a product of hysterical mass confusion A ship of fools adrift on the sea of our pollution Rudderless and powerless on the sea of our delusion pennywise - this is only a test
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.