Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Help me ! Urgent.

Help me ! Urgent.

Scheduled Pinned Locked Moved Visual Basic
sysadminhelpcsharp
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    d_smit
    wrote on last edited by
    #1

    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.

    C T L 3 Replies Last reply
    0
    • D d_smit

      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.

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      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

      D 1 Reply Last reply
      0
      • C Colin Angus Mackay

        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

        D Offline
        D Offline
        d_smit
        wrote on last edited by
        #3

        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.

        S C 2 Replies Last reply
        0
        • D d_smit

          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.

          S Offline
          S Offline
          Sonia Gupta
          wrote on last edited by
          #4

          i think u should change the port name .

          1 Reply Last reply
          0
          • D d_smit

            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.

            C Offline
            C Offline
            Colin Angus Mackay
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            • D d_smit

              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.

              T Offline
              T Offline
              Tom Wright
              wrote on last edited by
              #6

              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

              1 Reply Last reply
              0
              • D d_smit

                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.

                L Offline
                L Offline
                leckey 0
                wrote on last edited by
                #7

                Stop using URGENT! You have been warned at least twice. Either read the guidelines and comply or stop posting.

                __________________ Bob is my homeboy.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups