Issue information

Issue ID
#15
Status
Fixed
Severity
None
Started
Hercules Elf Bot
Sep 5, 2007 19:32
Last Post
Hercules Elf Bot
Mar 15, 2012 13:07
Confirmation
N/A

Hercules Elf Bot - Sep 5, 2007 19:32

Originally posted by [b]theultramage[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=15

EAPP uses read() / write() to do socket data transfers, instead of the more appropriate send() / recv() pair.
On unix this is no problem because sockets are file descriptors as well.
On windows/VS, in-line substitution is performed so that send/recv is used instead - no problem.

On windows/MinGW+gcc, a badly chosen combination of #ifdefs makes this substition get skipped.
The result is that the servers will error out on each read/write attempt.
Took me a while to trace because eapp sadly doesn't print any status messages...

Anyway. Either replace all writes/reads by send/recv and remove the windows-specific wrappers, or do the #ifdefs correctly.

for reference
CODE
#ifdef WIN32
#if !defined(__GNUC__)
// unix specific interface for windows
extern inline int read(SOCKET fd, char*buf, int sz)        
{
    return recv(fd,buf,sz,0);
}
extern inline int write(SOCKET fd, const char*buf, int sz)    
{
    return send(fd,buf,sz,0);
}
#endif