Multi User chat.

conversion from c# to vb.net

Page 1 of 1

1 Replies - 4410 Views - Last Post: 29 September 2009 - 11:25 AM Rate Topic: -----

#1 crzyone9584  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 198
  • Joined: 22-April 08

Multi User chat.

Posted 29 September 2009 - 11:21 AM

I'm looking at the following tutorial.

http://www.codeproje.../TCPIPChat.aspx

My problem is its in c#. I have used this site to change it from c# to vb.net

http://www.developer...t/csharp-to-vb/

I havnt plugged in any code except for the server part.

IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Any, 8000);
Socket newsock = Socket(AddressFamily.InterNetwork,
				   SocketType.Stream, ProtocolType.Tcp);
newsock.Bind(localEndPoint);
newsock.Listen(10);
Socket client = newsock.Accept();


That is teh c# for server.

It went to

Dim ipep As New IPEndPoint(Ipaddress.Parse("127.0.0.1"), 8000)
Dim server As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
server.Connect(ipep)


I put into VS 2008 and had some errors. i fixed them by importing

Imports System.Net.Sockets
Imports System.Net

I still have one error which i don't know how to fix.

Dim newsock As Socket = Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)


The error is on the socket that is after =

'Socket' is a type and can not be used an an expression.

I was how to go about and fixing this. As im sure ill run into this type of error more while converting the client side of the application.

Is This A Good Question/Topic? 0
  • +

Replies To: Multi User chat.

#2 motcom  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 290
  • View blog
  • Posts: 1,371
  • Joined: 16-June 08

Re: Multi User chat.

Posted 29 September 2009 - 11:25 AM

Hi,
the problem is that it has a constructor and needs to be declared as new and the statement for this is

Dim newsock As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)



or

Dim newsock As Socker =  New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)



;)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1