473,387 Members | 3,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Socket errors

I'm looking through a complex script at the moment.
If the OS is FreeBSD, the script defines EINPROGRESS to error 36 (Operation
now in progress), EALREADY to error 37 (Operation already in progress), and
EISCONN to error 56 (Socket is already connected). If it's Linux, then sets
them to 115, 114 and 106 respectively. I want to try and add Windows
compatability to this code. I've printed a list of all Windows socket error
codes from 0 to 15000, but can't find the similar errors, anyone got any
ideas?
Jul 17 '05 #1
1 3295
"Oli Howson" <ol*@badllama.net> wrote in
news:TU*****************@fe2.news.blueyonder.co.uk :
I'm looking through a complex script at the moment.
If the OS is FreeBSD, the script defines EINPROGRESS to error 36
(Operation now in progress), EALREADY to error 37 (Operation already
in progress), and EISCONN to error 56 (Socket is already connected).
If it's Linux, then sets them to 115, 114 and 106 respectively. I want
to try and add Windows compatability to this code. I've printed a list
of all Windows socket error codes from 0 to 15000, but can't find the
similar errors, anyone got any ideas?


Windows defines a WSAEINPROGRESS constant in API, which is the closest
equivalent to FreeBSD's EINPROGRESS, though I don't know whether or not
it would be available to PHP. In fact I rather doubt it.

Sockets compatibility between BSD (or BSD-like stacks, including pretty
much any Unix) and Windows is notoriously pesky regardless of language,
because Windows does not implement all of the BSD socket capabilities,
e.g. good luck trying SO_RCVTIMEO or SO_SNDTIMEO on Windows. Options that
FreeBSD will happily support for setsockopt() in C don't work on Windows,
and I imagine the same is true for socket_set_option() in PHP.

My suggestion would be to attempt to simulate test conditions where you
know what the error will be, and see what socket_last_error() returns in
each case. If anyone can give some better input, I'd be just as
interested in it as you are! While I don't currently do PHP on Windows, I
do a fair bit of sockets in PHP, so the more platforms the merrier.

hth
--
Bulworth : PHP/MySQL/Unix | Email : str_rot13('f@fung.arg');
--------------------------|---------------------------------
<http://www.phplabs.com/> | PHP scripts, webmaster resources
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Gustavo Barbosa | last post by:
I´m having this problem: I'm stress testing a ASP.NET web application using ACT and comparing results with a previous version of the website (developed in ColdFusion 4.5). When using 300...
1
by: Gustavo Barbosa | last post by:
I´m having this problem: I'm stress testing a ASP.NET web application using ACT and comparing results with a previous version of the website (developed in ColdFusion 4.5). When using 300...
2
by: John Nagle | last post by:
Here's a strange little bug. "socket.getaddrinfo" blows up if given a bad domain name containing ".." in Unicode. The same string in ASCII produces the correct "gaierror" exception. Actually,...
10
by: John Nagle | last post by:
Here are three network-related exceptions. These were caught by "except" with no exception type, because none of the more specific exceptions matched. This is what a traceback produced: 1....
6
by: Pat B | last post by:
Hi, I'm writing my own implementation of the Gnutella P2P protocol using C#. I have implemented it using BeginReceive and EndReceive calls so as not to block when waiting for data from the...
2
by: Robin Becker | last post by:
While messing about with some deliberate socket timeout code I got an unexpected timeout after 20 seconds when my code was doing socket.setdefaulttimeout(120). Closer inspection revealed that...
1
by: orehian | last post by:
Construct a one-time password system. · Write a server code and a client code. The server code takes as input a username and a one-time password from the client and then sends a message...
10
by: ThunderMusic | last post by:
Hi, I'm currently working with sockets. I accept connections using m_mySocket.Listen(BackLogCount); But when I want to stop listening, I shutdown all my clients and call m_mySocket.Close(), but it...
2
by: manasap | last post by:
Hi all! I've written a server and a client application using asynchronous sockets.The client sends data packets for every 7 seconds.The server receives the packets. This process proceeds...
3
by: A. W. Dunstan | last post by:
I'm creating a socket as follows: m_networkSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); m_networkSocket.LingerState = new LingerOption(true, 1);...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.