Recent

Author Topic: UDP Client is not working  (Read 13156 times)

rotation

  • New Member
  • *
  • Posts: 12
UDP Client is not working
« on: April 01, 2014, 11:58:03 am »
Hello!
I have a problem with UDPServer and UDPClient from Indy 10 in Lazarus on Fedora 16. When I compile the project for UDP connection, I can't to see where is the wrong.
In the attached file, I am posted screenshot for error report.
Please, help me!

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: UDP Client is not working
« Reply #1 on: April 01, 2014, 01:37:16 pm »
Just a guess, form would somehow be creating client before the server (wouldn't surprise me, alphabetically C comes before S), and therefore not be able to connect. You could ensure that by setting Active to false, and in the startup, for example TForm's onCreate event set it to true.

rotation

  • New Member
  • *
  • Posts: 12
Re: UDP Client is not working
« Reply #2 on: April 01, 2014, 03:13:37 pm »
I make the follow changes on the screenshot as an attachment

Where I am not ok?

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1262
Re: UDP Client is not working
« Reply #3 on: April 01, 2014, 04:43:11 pm »
In your code you're creating the server.  BUT it already exists on your form, so there is no need to create it.

Comment out the Create lines, leaving just the Active lines.  See what happens.  (And I'm not saying this will work either, just saying that the create is definitely wrong...)

Also, are you sure nothing else on your PC is using Port 8012?
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

rotation

  • New Member
  • *
  • Posts: 12
Re: UDP Client is not working
« Reply #4 on: April 01, 2014, 05:24:49 pm »
I deleted create lines, but it says 'Socket Error #98' from attached screenshot.

I set to Firewall Port 8012 with UDP protocol for enable, but nothing, socket error 8-)

Laksen

  • Hero Member
  • *****
  • Posts: 774
    • J-Software
Re: UDP Client is not working
« Reply #5 on: April 01, 2014, 05:30:10 pm »
Port and BoundPort can not be the same for the client. The server binds to that Port already, and you can't bind two UDP sockets to the same port on the same computer.

Change the BoundPort to something else

rotation

  • New Member
  • *
  • Posts: 12
Re: UDP Client is not working
« Reply #6 on: April 01, 2014, 05:39:32 pm »
And again error with changed Boundport

Laksen

  • Hero Member
  • *****
  • Posts: 774
    • J-Software
Re: UDP Client is not working
« Reply #7 on: April 01, 2014, 08:00:00 pm »
Did you add -dUseCThreads to your projects Custom options?

rotation

  • New Member
  • *
  • Posts: 12
Re: UDP Client is not working
« Reply #8 on: April 01, 2014, 08:48:34 pm »
Sorry, I am new user in Lazarus, how i can to add that -dUseCThreads?

Edit: I found a topic:
http://forum.lazarus.freepascal.org/index.php/topic,8852.msg43783.html#msg43783
« Last Edit: April 01, 2014, 09:01:39 pm by rotation »

rotation

  • New Member
  • *
  • Posts: 12
Re: UDP Client is not working
« Reply #9 on: April 01, 2014, 10:07:21 pm »
Thank you everyone for your support!
It works exactly :)

 

TinyPortal © 2005-2018