Is it able to directly use socket() API in server while use thrift lib in client? As directly use the API include socket(), write(), etc, there is no Protocol here, directly write a struct. While in client, it use org.apache.thrift.protocol.TProtocol.readStructBegin, readString, readI64, etc...
Sure. The common part of any software/communication contract is that both sides must adhere to the protocols(s) as specified. But there is no law that you have to do it in one specific way only.