Re: Help porting UNIX Socket Based App

From: Joseph M. Newcomer (newcomer_at_flounder.com)
Date: 02/23/05


Date: Wed, 23 Feb 2005 12:03:51 -0500

I think the question is, what is meant by "AF_UNIX_SOCK_STREAM" and "AF_UNIX"? Can you say
what these actually do, and why they are different from AF_INET and AF_SOCK_STREAM, on
Unix? Without knowing what these were intended to mean, it is hard to guess how to convert
them.
                                joe
On Wed, 23 Feb 2005 07:30:06 -0600, "Jim Jones"
<jim@pleaseremovethisalongwithdash-qtextender.com> wrote:

>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;
>}
>

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm



Relevant Pages

  • Re: Binary File Reader
    ... knowing how they were created it is absolutely impossible to describe how to read them. ... Joseph M. Newcomer ... MVP Tips: http://www.flounder.com/mvp_tips.htm ... Prev by Date: ...
    (microsoft.public.vc.mfc)
  • Question on Unix 3.5 Install on Windows 2003 Server
    ... pilot server was built on a 2003 platform, before knowing that this was ... I have downloaded the Unix 3.5 Services and currently ... reviewing the information. ...
    (microsoft.public.windowsmedia.server)
  • Re: When presses ENTER on Edit BOX
    ... There is ALWAYS an explanation about WHY this happened. ... Knowing ... MVP Tips: http://www.flounder.com/mvp_tips.htm ...
    (microsoft.public.vc.mfc)
  • rstp & FreeBSD
    ... I'm sure we support rstp Ethernet for redundancy, ... find the documentation. ... The hard part of any UNIX is knowing which man page to read. ...
    (freebsd-net)
  • Re: Does anyone know how to simulate a HTTP POST with a binary file?
    ... So is Unix, ... >>I would use some program that converted the binary data to hex character ... Then convert the hex byte stream ... MVP Tips: http://www.flounder.com/mvp_tips.htm ...
    (microsoft.public.vc.mfc)