Help me ! Urgent.
-
hi, i have developed a client-server application in vb.net. I am using a socket class in this application. I have written the following code: Dim wsTCP As New TcpClient Dim nwStream As NetworkStream Dim byt_Buffer() As Byte Dim async_CallBack As AsyncCallback Dim ipLocal As System.Net.IPAddress = IPAddress.Parse("MyIpaddress") Dim wsTcpLst As New TcpListener(ipLocal, portno) wsTcpLst.Start() If wsTcpLst.Pending = True Then wsTCP = wsTcpLst.AcceptTcpClient wsTCP.Connect(ipaddress, portno) nwStream = wsTCP.GetStream byt_Buffer = System.Text.ASCIIEncoding.ASCII.GetBytes("hello") nwStream.BeginWrite(byt_Buffer, 0, byt_Buffer.Length, Nothing, Nothing) wsTCP .close endif I am getting the error: Only one usage of each socket address (protocol/network address/port)is normally permitted at line wstcplst.start. Please help me out at the earliest how this can be resolved. Thanks in advance.
-
hi, i have developed a client-server application in vb.net. I am using a socket class in this application. I have written the following code: Dim wsTCP As New TcpClient Dim nwStream As NetworkStream Dim byt_Buffer() As Byte Dim async_CallBack As AsyncCallback Dim ipLocal As System.Net.IPAddress = IPAddress.Parse("MyIpaddress") Dim wsTcpLst As New TcpListener(ipLocal, portno) wsTcpLst.Start() If wsTcpLst.Pending = True Then wsTCP = wsTcpLst.AcceptTcpClient wsTCP.Connect(ipaddress, portno) nwStream = wsTCP.GetStream byt_Buffer = System.Text.ASCIIEncoding.ASCII.GetBytes("hello") nwStream.BeginWrite(byt_Buffer, 0, byt_Buffer.Length, Nothing, Nothing) wsTCP .close endif I am getting the error: Only one usage of each socket address (protocol/network address/port)is normally permitted at line wstcplst.start. Please help me out at the earliest how this can be resolved. Thanks in advance.
Some other application would appear to be already listening on the port you want to use. e.g. If you are listening on port 80 then you'll have to shut down IIS first (because it got there first)
Upcoming events: * Glasgow: SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website
-
Some other application would appear to be already listening on the port you want to use. e.g. If you are listening on port 80 then you'll have to shut down IIS first (because it got there first)
Upcoming events: * Glasgow: SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website
how it can be done, from client application i am sending data server. both are listening the same port which is required so that they will be able communication. so how can i keep the port open at both end to listen. how iis can be shut down. Please elaborate. thanks.
-
how it can be done, from client application i am sending data server. both are listening the same port which is required so that they will be able communication. so how can i keep the port open at both end to listen. how iis can be shut down. Please elaborate. thanks.
i think u should change the port name .
-
how it can be done, from client application i am sending data server. both are listening the same port which is required so that they will be able communication. so how can i keep the port open at both end to listen. how iis can be shut down. Please elaborate. thanks.
d_smita wrote:
both are listening the same port
Then how do you test or use your application when the client and server happen to be the same machine? You listen on one port and you send on another. When you use IE to browse the web, IE sends data to port 80 of the server, but it listens on port 3xxx for a reply. Remember for any communications you need two end points - the end point on the client and the end point on the server. Typically the server will be listening on a static port. This is necessary because clients have to connect with it some how. The client can use a variable port because it has the opportunity to communicate that with the server. It means that the client can also have multiple ports open to the server. So, your client initiates the communication and opens a socket. The server will respond on that socket.
Upcoming events: * Glasgow: SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website
-
hi, i have developed a client-server application in vb.net. I am using a socket class in this application. I have written the following code: Dim wsTCP As New TcpClient Dim nwStream As NetworkStream Dim byt_Buffer() As Byte Dim async_CallBack As AsyncCallback Dim ipLocal As System.Net.IPAddress = IPAddress.Parse("MyIpaddress") Dim wsTcpLst As New TcpListener(ipLocal, portno) wsTcpLst.Start() If wsTcpLst.Pending = True Then wsTCP = wsTcpLst.AcceptTcpClient wsTCP.Connect(ipaddress, portno) nwStream = wsTCP.GetStream byt_Buffer = System.Text.ASCIIEncoding.ASCII.GetBytes("hello") nwStream.BeginWrite(byt_Buffer, 0, byt_Buffer.Length, Nothing, Nothing) wsTCP .close endif I am getting the error: Only one usage of each socket address (protocol/network address/port)is normally permitted at line wstcplst.start. Please help me out at the earliest how this can be resolved. Thanks in advance.
It's because you are doing a listen and a connect on the same port. If you have your app setup as a server then you are going to listen and accept and pass the handle off so that the server can listen for more connections. If you app is a client then you are going to connect to the server and start sending and or receiving data. Look at some the client server tutorials on this site.
Tom Wright tawright915@gmail.com
-
hi, i have developed a client-server application in vb.net. I am using a socket class in this application. I have written the following code: Dim wsTCP As New TcpClient Dim nwStream As NetworkStream Dim byt_Buffer() As Byte Dim async_CallBack As AsyncCallback Dim ipLocal As System.Net.IPAddress = IPAddress.Parse("MyIpaddress") Dim wsTcpLst As New TcpListener(ipLocal, portno) wsTcpLst.Start() If wsTcpLst.Pending = True Then wsTCP = wsTcpLst.AcceptTcpClient wsTCP.Connect(ipaddress, portno) nwStream = wsTCP.GetStream byt_Buffer = System.Text.ASCIIEncoding.ASCII.GetBytes("hello") nwStream.BeginWrite(byt_Buffer, 0, byt_Buffer.Length, Nothing, Nothing) wsTCP .close endif I am getting the error: Only one usage of each socket address (protocol/network address/port)is normally permitted at line wstcplst.start. Please help me out at the earliest how this can be resolved. Thanks in advance.