EiffelNet sample problems on Windows
- Hello guys,
I start learning Eiffel recently, and I want to create a simple server/clients communication (as a chat) with EiffelNet.
I'm using Windows seven, and the EiffelStudio with the Microsoft compiler.
I was able to run the two_match sample, but I suppose that the socket.accept method makes communication Synchronous and to handle multiple clients this way I should need to use threads and mutex. Is there another way?
Then, I tried to run the polling and the advanced samples.
On the advanced sample, the server chat starts, and I'm able to enter my name, but after that it raises an exception: "WSAENOTSOCK: The descriptor is not a socket", on the 'poll.execute (max_to_poll, 50)' line. There's an old message about what appears to be the problem http://tech.groups.yahoo.com/group/eiffel_software/message/1379 , is windows not supported for this example?
Running the polling sample gives me an "Net error #10040: I/O error.".
Can someone tell me if there is a functional chat like example for windows?
> I was able to run the two_match sample, but I suppose that theIn theory, if you need multiprocessing, you have one thread that creates a socket
> socket.accept method makes communication Synchronous and to handle
> multiple clients this way I should need to use threads and mutex. Is
> there another way?
and calls in a loop `accept'. Each time `accept' returns, you get the `accepted'
socket and pass it to another thread to perform the operation. There is no need
for a mutex for that part.
> Then, I tried to run the polling and the advanced samples.The polling example is indeed failing with this error, we will fix it for the next
release, in the meantime edit DATAGRAM_READER and change the hard coded length 10
by 14 at line 35.
The advanced sample is Unix specific because it tries to wait for input using
`select' and this is not supported on Windows.
> Can someone tell me if there is a functional chat like example forActually one can modify the advanced example to make it work on Windows. The
reason select is used in the example is to do something in case the user hasn't
typed anything after a predefined timeout, that way when a user type something,
all users get the message after that timeout. On Windows, we can remove that code
and one way to get the messages from other clients is to simply press return. If
it was a graphical application, we can have an idle action that checks every
timeout milliseconds if a new message has arrived. We will improve this for the
next release so that it executes properly on Windows.