Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Extra libraries, Code snippets, applications etc. » C++ language problems and code snippets » UDP Server/Client with Winsock
UDP Server/Client with Winsock [message #49844] Wed, 16 May 2018 16:58 Go to next message
lovmy is currently offline  lovmy
Messages: 44
Registered: November 2015
Member

Hello,

i'm using version 11873 of TheIDE. I try to compile a code to do UDP connexion between server and client using Winsock.

Compiling is OK but linking finish with error:

undefined reference to WSAStartup

I think GCC don't found ws2_32.lib, but the path where this file is present is ok (...mingw64/32/i686-w64-mingw32/lib) and i have add "-lws2_32" in Common link option.

Where is my error ? Sorry i don't speak very well English.
  • Attachment: udp.png
    (Size: 112.41KB, Downloaded 283 times)
Re: UDP Server/Client with Winsock [message #49845 is a reply to message #49844] Wed, 16 May 2018 19:38 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1075
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello,

We definitely needs more information. Can you post your compilation output? Moreover, it will be nice to have the code you are linking against.

___________
Off topic, I see you created Android builder. Nice to know Smile

Sincerely,
Klugier


U++ - one framework to rule them all.

[Updated on: Wed, 16 May 2018 19:38]

Report message to a moderator

Re: UDP Server/Client with Winsock [message #49847 is a reply to message #49844] Thu, 17 May 2018 08:47 Go to previous messageGo to next message
lovmy is currently offline  lovmy
Messages: 44
Registered: November 2015
Member

Hello

I'm just trying to make a server client in UDP using Winsock (so under Windows).
I use the Windows version of TheIDE.
Here is the source code, it's just the beginning.

I had already tested TCP socket under Freebsd, and did not have the problem of linking.

I did some tests with Android, it works well.

Thank you for your help.
Re: UDP Server/Client with Winsock [message #49848 is a reply to message #49847] Fri, 18 May 2018 08:09 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Well, the problem is that options that you put into build method are inserted to the link command line BEFORE the list of files, which makes causes the issue.

To do it correctly, you should put this as package feature (that will make it independt from build method too).

See screenshot:

index.php?t=getfile&id=5577&private=0

[Updated on: Fri, 18 May 2018 08:10]

Report message to a moderator

Re: UDP Server/Client with Winsock [message #49849 is a reply to message #49844] Fri, 18 May 2018 10:03 Go to previous messageGo to next message
lovmy is currently offline  lovmy
Messages: 44
Registered: November 2015
Member

Hello !

Thank you, now it's work fine ! Surprised

Have a nice day !
Re: UDP Server/Client with Winsock [message #49850 is a reply to message #49844] Fri, 18 May 2018 13:33 Go to previous messageGo to next message
lovmy is currently offline  lovmy
Messages: 44
Registered: November 2015
Member

Just a question...

I see it's existing a Upp::TcpSocket package. But i don't know if exist a Upp::UdpSocket package.

If it's not the case i will try to do one.
Re: UDP Server/Client with Winsock [message #49851 is a reply to message #49850] Fri, 18 May 2018 14:10 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
UdpSocket does not exist mostly because sending/recieving UDP is way too trivial, so there is basically nothing to encapsulate.

BTW, you can check bazaar/Urr - years ago I needed UDP based server, so I have played with UDP a little and there is a result.

Previous Topic: THISFN and Thread
Next Topic: What is the difference between the memory management in C and C++?
Goto Forum:
  


Current Time: Fri Mar 29 08:21:50 CET 2024

Total time taken to generate the page: 0.01921 seconds