Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 244
  • Last Modified:

(Urgent) Obtain data into a buffer continuously and send this data over the win socket to a flash application

Hi all,
       I am new to VB and VB .NET and i have to write an application that can continuously read data from a buffer and send this data over TCP socket to another application. Basically send it over the socket.
As i was not familiar with VB .NET socket application, i looked up VB 6.0 TCP client/server application and i got it working. I also got the VB server talk to the flash application over the socket.
Now, i am trying to migrate to VB .NET and am not finding helpful examples for the same.
Also, how do i read data continuously from a buffer and send it over the socket. While(1) seems to hang the application (standard exe).
Summary:
=======
1. Socket communication using .NET
2. Read continuously and send out

Any pointers, help code would be helpful.

thanks a bunch,
Sang
0
sanggeek
Asked:
sanggeek
  • 2
1 Solution
 
srcalcCommented:
OK, well your VB 6 sample probably used the Winsock control, which is not used in VB .NET. I found the MSDN sample on TCP/IP communication infinately helpful. You can find it in the 101 VB .NET samples, its called "Advanced .NET Framework (Networking) - Use Sockets"

http://www.microsoft.com/downloads/details.aspx?FamilyId=08E3D5F8-033D-420B-A3B1-3074505C03F3&displaylang=en
0
 
sanggeekAuthor Commented:
Hi,
  Thank you for pointing me to the website. I am learning from it.
All I want to achieve is this simple functionality of the following which is in VB 6.0, in VB .NET, be it using winsock or streamwriter, write. Especially, i want to be able to send a string (not bytes), and then send chr(0) - In VB .NET you cannot send a chr(0), i am not sure what the replacement is....
(this is because the client application assumes end of data to be chr(0).)

Any form of help would be appreciated
thanks again,
Sang

Private Sub cmdSend_Click()
    ' send data from the textbox
    Winsock.SendData txtChat.Text
    Winsock.SendData Chr(0)
    DoEvents
End Sub

Private Sub Form_Load()
    ' set up the socket to listen on port 10101
    Winsock.LocalPort = 10101
    Winsock.Listen
End Sub

0
 
sanggeekAuthor Commented:
Can you please delete this question and give me a refund.

I used the exact same code posted above by me using Winsock except one minor change and it worked.
thank you.
Sang
0
 
DarthModCommented:
Submitted to PAQ with points refunded (200)

DarthMod
Community Support Moderator
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now