2 Programs - vb.net and Winsock?

robertuk702

Member
Joined
Apr 23, 2006
Messages
15
Programming Experience
Beginner
Hi,

A lecturer told me last night that I could use something called Winsock in vb.net? what is it and how do I get it to work?

basically, one program will reside on the client pc and the other on the server pc. The one on the client will send a number to the one on the server pc and the program on the server pc will send a response back to the client pc saying yes or no. Thats what I am trying to achieve. Input in vb is relatively easy. so i can nail that, just dont know where to start with the client server bit.

Can you help?

Thank you.

Regards.
 
You will find much help if you look at the other posts in this forum you posted (Net/Sockets) or search for "TcpClient" at these forums and the web.
 
need a little help

Hi,

I found code at the following link, so have copied it into mine.

http://www.eggheadcafe.com/articles/20020323.asp

Problem 1: Imports error - statements must precede any declarations. What have i missed?

Problem 2. Dim Networkstream as NetworkStream - type doesnt exist. Anyone know what this could be?

Problem3.
Dim
sendBytes As [Byte]() = Encoding.ASCII.GetBytes("Is anybody there") - doesnt like the 'Encoding' word. Anyone know what this could be?

From there on in i think it is down to me once I can get these solved.

Thank you for your help.

Regards.
 
1. "statements must precede any declarations" means that the imports statements must be placed before anything else in your class file.
Correctly importing those namespaces solves your problems 2 and 3 too.
 
class

Hi,

So if i put public or private before class then it should solve the problem? Or should I put the imports statements at the top of the code?

Thank you for your help, it will be much appreciated if I can get it working and even if i can't its still a good try :)

Regards.
 
put the imports statements at the top of the code
 
thank you

that removed the blue lines.

daft question but should I convert my application to a console application rather than a windows application?

Regards,

Robert.
 
Back
Top