Help porting UNIX Socket Based App

From: Jim Jones (jim_at_pleaseremovethisalongwithdash-qtextender.com)
Date: 02/23/05


Date: Wed, 23 Feb 2005 07:30:06 -0600

What is your suggested changes in order to port the following code segment
to the Windows platform? AF_UNIX? I don't understand these definitions.

int
gaim_remote_session_connect(int session)
{
 gint fd;
 uid_t stored_uid, euid;
 struct sockaddr_un saddr;

 if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) != -1)
 {
  saddr.sun_family = AF_UNIX;
  stored_uid = getuid();
  euid = geteuid();
  setuid(euid);
  sprintf(saddr.sun_path, "%s/gaim_%s.%d",
    g_get_tmp_dir(), g_get_user_name(), session);
  setreuid(stored_uid, euid);

  if (connect(fd, (struct sockaddr *) &saddr, sizeof (saddr)) != -1)
   return fd;
 }

 close(fd);

 return -1;
}