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 » U++ Library support » U++ Widgets - General questions or Mixed problems » failure to use SOCKET and an exception question
failure to use SOCKET and an exception question [message #13125] Fri, 14 December 2007 07:09 Go to next message
bonami is currently offline  bonami
Messages: 186
Registered: June 2007
Location: Beijing
Experienced Member
me again Embarassed
now i'm using MS SOCKET. in function ezUdp::relate() i create it and bind it. function ezUdp::establish calls relate and then sendto(), which fails.

run the program and write local IP and a port in the upper left corner and enter another IP and port in the upper right corner. write something in the left field and "send". you can see it (sendto()) complains it is not a valid socket.

if you write an IP other then your own, which should cause bind() to fail, you can see it still complains at sendto(), instead of bind(), i.e., establish() does not throw the exception relate() throws. if you explicitly throw a std::string, it just works same.

if i move the operations from relate() to establish(), it runs well.

note that ezcommon directory is to hold header files only, and need not be compiled.
  • Attachment: ezcomm.zip
    (Size: 326.97KB, Downloaded 237 times)

[Updated on: Fri, 14 December 2007 08:36]

Report message to a moderator

Re: failure to use SOCKET and an exception question [message #13126 is a reply to message #13125] Fri, 14 December 2007 10:27 Go to previous message
bonami is currently offline  bonami
Messages: 186
Registered: June 2007
Location: Beijing
Experienced Member
SOCKET problem solved. i did not initialize socketStatus. since it is enum type, i supposed class initialization would set it to 0 for me but it does not. thus relate() returns at the beginning.

but still, if i do not initialize socketStatus, and change its check from return; to throw ...; in relate(), program crashes instead of doing the exception procedure.
Previous Topic: Is it possible to get Ctrl name during runtime (or similar)?
Next Topic: Moving objects on a layout and chessboard
Goto Forum:
  


Current Time: Fri Apr 26 00:00:13 CEST 2024

Total time taken to generate the page: 3.94295 seconds