return address;
}
+ public static InetAddress getLocalHost() {
+ return getByName("localhost");
+ }
+
+ public boolean equals(InetAddress ia) {
+ if (ia==null)
+ return false;
+ if (ia.address.length!=address.length)
+ return false;
+ for(int i=0;i<address.length;i++)
+ if (ia.address[i]!=address[i])
+ return false;
+ return true;
+ }
+
public static InetAddress[] getAllByName(String hostname) {
InetAddress[] addresses;
}
public static native byte[][] getHostByName(byte[] hostname);
+
+ public String toString() {
+ String h=hostname+" ";
+ for (int i=0;i<address.length;i++) {
+ if (i>0)
+ h+=".";
+ h+=(int)address[i];
+ }
+ return h;
+ }
}
#endif
}
+#ifdef MAC
+ if (setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &n, sizeof (n)) < 0) {
+ perror("socket");
+ exit(-1);
+ }
+#endif
+
#ifdef TASK
fcntl(fd, F_SETFD, 1);
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL)|O_NONBLOCK);
struct listitem *tmp=stopforgc((struct garbagelist *)___params___);
#endif
#endif
- int byteread;
+ int byteread=-1;
// printf("Doing read on %d\n",fd);
- while(1) {
+ do {
byteread=read(fd, charstr, length);
-
- break;
- }
+ } while(byteread==-1&&errno==EINTR);
#ifdef THREADS
#ifdef PRECISE_GC
restartaftergc(tmp);
if (byteread<0) {
printf("ERROR IN NATIVEREAD\n");
perror("");
- byteread=0;
}
#ifdef TASK
flagorand(VAR(___this___),0,0xFFFFFFFE);