dg server code