Results 1 to 14 of 14

Thread: Winsock SendData Problems

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    Code:
    Winsock1.RemoteIP = "127.0.0.1"
    Winsock1.RemotePort = 1000
    Winsock1.Connect
    
    Dim MyMessage as String
    MyMessage = "Hello, My Name Is Steve"
    Winsock1.SendData MyMessage
    I get an error on the last line of that code. Why?

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    By the way, ive tried
    Winsock1.SendData (MyMessage)
    and I still got the error.

  3. #3
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    292
    It looks like you are connecting to yourself, do you have a server program runnign to listen on that port? Sorry if I sound insulting.
    "People who think they know everything are a great annoyance to those of us who do."

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    No, that form that that code goes into listens to 1001, the server form sends from 1001 and listens to 1000. I asked about how many ports before. Since 1 - 1024 are reserved for http and ftp, do you think the internet is screwing me up and giving me these problems? Maybe I should make the ports lke 2000, and 2001?

  5. #5
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    are you using TCP or UDP?

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    Every winsock control uses TCP

  7. #7
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    292
    I may be reading your post wrong but it sounds like you've got the way TCP works a bit mixed up.
    When you say:
    Winsock1.RemoteIP = "127.0.0.1"
    Winsock1.RemotePort = 1000
    Winsock1.Connect1

    There has to already be a server program listening to port 1000 on your machine, otherwise no connection will be established and thus you cant send any data.
    "People who think they know everything are a great annoyance to those of us who do."

  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    Sorry, this is my first winsock program. What is the different between TCP and UDT?

  9. #9
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    292
    The main difference between TCP and UDP is that TCP is connection oriented where UDP isnt. TCP is also much more reliable than UDP. But UDP has a much lower overhead for use then TCP.
    This link might help you out with using the control:
    http://www.vbsquare.com/internet/comms/
    "People who think they know everything are a great annoyance to those of us who do."

  10. #10

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    Thanks noone! That was the perfect tutorial! Just what I needed!

  11. #11
    Junior Member
    Join Date
    Mar 2000
    Posts
    28
    I would put the SendData command in the Winsock_Connect event. If you send the data before Winsock connects, you'll get an error.

  12. #12

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    No its connected. The start button (where the senddata is) is dissabled until connected.

  13. #13
    Member FirePoweR's Avatar
    Join Date
    Apr 1999
    Posts
    32
    What error are you getting?

  14. #14

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    Hold on, for some reason its working......thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width