Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (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 by darknuke

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

Posted
Private Sub sendMessage_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles sendMessage.KeyPress

someSub()

End Sub

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...