work for socket apis and refactor file struct

work for socket apis and refactor file struct