KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ozoneDB > DxLib > net > DxServer


1 // You can redistribute this software and/or modify it under the terms of
2
// the Ozone Library License version 1 published by ozone-db.org.
3
//
4
// The original code and portions created by SMB are
5
// Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
6
//
7
// $Id: DxServer.java,v 1.2 2003/03/12 12:30:23 per_nyfelt Exp $
8

9 package org.ozoneDB.DxLib.net;
10
11 import org.ozoneDB.io.stream.ResolvingObjectInputStream;
12
13 import java.net.*;
14 import java.io.*;
15
16 /**
17  * DxServer ist eine einfache Socketverbindung an einem speziellen Port, an
18  * welche DxCompatible's gesendet bzw. empfangen werden können.
19  *
20  *
21  * @author <a HREF="http://www.softwarebuero.de/">SMB</a>
22  * @version $Revision: 1.2 $Date: 2003/03/12 12:30:23 $
23  */

24 public class DxServer extends DxClient {
25     ServerSocket server;
26
27
28     public DxServer( int port ) throws IOException{
29         server = new ServerSocket( port );
30     }
31
32
33     public void accept() throws IOException {
34         sock = server.accept();
35
36         out = new ObjectOutputStream( new BufferedOutputStream( sock.getOutputStream() ) );
37         out.flush();
38         in = new ResolvingObjectInputStream( new BufferedInputStream( sock.getInputStream() ) );
39     }
40
41
42     public void close() throws IOException {
43         super.close();
44         server.close();
45     }
46 }
47
Popular Tags