|
-
Aug 7th, 2005, 04:51 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Is this syntax wrong? Why doesnt this work?
Hello ...
Can someone tell me why this doesnt work?
VB Code:
Dim sthing As New System.Net.Sockets.TcpListener(8788)
Isnt that abover constructor supposed to take in the port value alone too?
Its giving me this error..
Code:
C:\Documents and Settings\Godwin\My Documents\Visual Studio Projects\WindowsApplication7\Form1.vb(65): 'Public Sub New(port As Integer)' is obsolete: 'Use TcpListener(IPAddress localaddr, int port).'
Please help me,Thanks
Godwin
Help someone else with what someone helped you! 
-
Aug 7th, 2005, 04:51 AM
#2
Thread Starter
Fanatic Member
Re: Is this syntax wrong? Why doesnt this work?
I know I can use it like this...
TcpListener(IPAddress localaddr, int port)
but,why isnt it accepting the port alone?
Godwin
Help someone else with what someone helped you! 
-
Aug 7th, 2005, 05:49 AM
#3
Retired VBF Adm1nistrator
Re: Is this syntax wrong? Why doesnt this work?
It's exactly what it says it is: it's obselete To quote MSDN:
NOTE: This member is now obsolete.
Use TcpListener(IPAddress localaddr, int port).
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Aug 7th, 2005, 06:01 AM
#4
Thread Starter
Fanatic Member
Re: Is this syntax wrong? Why doesnt this work?
Thats what I dont know..what does that mean? Why isnt it accepting a port value though its supposed to accept? its there in the third option..
Godwin
Help someone else with what someone helped you! 
-
Aug 7th, 2005, 06:06 AM
#5
Retired VBF Adm1nistrator
Re: Is this syntax wrong? Why doesnt this work?
It probably existed in the 1.0 Framework, but has been marked obselete in 1.1, and will probably not be listed as one of the overloads in 2.0...
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Aug 7th, 2005, 06:17 AM
#6
Thread Starter
Fanatic Member
Re: Is this syntax wrong? Why doesnt this work?
Is it a "probably" or are you sure?
Godwin
Help someone else with what someone helped you! 
-
Aug 7th, 2005, 06:19 AM
#7
Retired VBF Adm1nistrator
Re: Is this syntax wrong? Why doesnt this work?
It's irrelevant - either way you're never going to be able to use it again
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Aug 7th, 2005, 06:21 AM
#8
Thread Starter
Fanatic Member
Re: Is this syntax wrong? Why doesnt this work?
No,my friend has the same .net2003 and he has used the same in his program..It works perfectly fine.It doesnt work only for me.
Godwin
Help someone else with what someone helped you! 
-
Aug 7th, 2005, 06:22 AM
#9
Thread Starter
Fanatic Member
Re: Is this syntax wrong? Why doesnt this work?
Well,I dont have his source code to see why and how.But,I think there is a way to use it the way it should be used.
Godwin
Help someone else with what someone helped you! 
-
Aug 7th, 2005, 06:22 AM
#10
Retired VBF Adm1nistrator
Re: Is this syntax wrong? Why doesnt this work?
What version of the Framework is he using? And you definitely won't be able to use this in the 2.0 Framework.
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Aug 7th, 2005, 06:23 AM
#11
Thread Starter
Fanatic Member
Re: Is this syntax wrong? Why doesnt this work?
No,we both use the 1.1 framework
Godwin
Help someone else with what someone helped you! 
-
Aug 7th, 2005, 06:24 AM
#12
Retired VBF Adm1nistrator
Re: Is this syntax wrong? Why doesnt this work?
And is he running SP1 of the 1.1 Framework?
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Aug 7th, 2005, 06:25 AM
#13
Thread Starter
Fanatic Member
Re: Is this syntax wrong? Why doesnt this work?
yes,the same .net2003 with .net 1.1 framework..Hes actively working on .net too
Godwin
Help someone else with what someone helped you! 
-
Aug 7th, 2005, 06:26 AM
#14
Retired VBF Adm1nistrator
Re: Is this syntax wrong? Why doesnt this work?
Without wanting to put too fine a point on it - a) I don't believe you, and b) Why won't you just listen to MSDN?
Look at:
http://msdn.microsoft.com/library/de...sctortopic.asp
The very first Overload is marked as Obselete. Just use their suggested code:
VB Code:
'Creates an instance of the TcpListener class by providing a local IP address and port number.
Dim ipAddress As IPAddress = Dns.Resolve("localhost").AddressList(0)
Try
Dim tcpListener As New TcpListener(ipAddress, 13)
Catch e As Exception
Console.WriteLine(e.ToString())
End Try
I'm not making any of this up... it's coming straight out of MSDN...
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Aug 7th, 2005, 06:29 AM
#15
Thread Starter
Fanatic Member
Re: Is this syntax wrong? Why doesnt this work?
You dont believe me?
Well,this is really the problem I am having.I wonder if you got the same error if you pasted the code there.
Im not sure if he has sp1 and stuff..but,he has the same .net2003 with .net1.1 framework
Godwin
Help someone else with what someone helped you! 
-
Aug 7th, 2005, 06:30 AM
#16
Thread Starter
Fanatic Member
Re: Is this syntax wrong? Why doesnt this work?
I cant specify the ipaddress since I dont know what the ipaddress would be.I thought the other syntax would probably automatically take the ip or something
Godwin
Help someone else with what someone helped you! 
-
Aug 7th, 2005, 06:35 AM
#17
Thread Starter
Fanatic Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|