wuwe 发表于 2003-7-2 10:03:29

网络配置问题

哪一位帮忙解决一下
在LINUX怎么样配置网络用到哪几文件
各个文件如何配置
请详解
多有麻烦,不胜感激

chg1226 发表于 2003-7-3 12:38:40

装好网卡后用netconfig,完全傻瓜型的。别外linux的网络服务是一个庞大的系统,不只几个文件那么简单,我敢打赌,没有人能把它所用的文件全部列出来,只能根据个人需要,掌握几个适合自己的,其它的还要靠的实践中逐步掌握。

wuwe 发表于 2003-7-4 09:42:28

能不能 帮我解释一下这几个网络文件
/etc/hosts
/etc/modules.conf
/etc/sysconfig/network
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/resolv.conf
它们到底是作什么用的,在做tcp/ip设置时,应如何设置他们其中的各项
能不能以ADSL为例,请不要教我如何用图形界面来设置,命令行可矣
--系本人极菜,不胜麻烦,若能 回答,感激不尽

wuwe 发表于 2003-7-4 09:50:03

能给我说明一下 /proc这个目录里放的是一些什么文件吗?
有一次我的机子突然断电,之后重启不能 进入系统,好像就是跟这个文件夹有关
这里面的文件有什么作用,粗略解释一下?

chg1226 发表于 2003-7-4 11:12:23

1.hosts类似windows里的lmhost,是主机名到IP的静态射映文件。
2.modules.conf:看名字就知道了,是模块的配置文件。
3.network:记录的是启动network是的参数。
4.ifcfg-ethX:是就你的网卡的配置文件了,可以用more看一下,IP、GATEWAY、 DEVICE、NETMASK等等,可以在这里改网卡的配置
5.resolv.conf:是DNS服务器的地址列表。每行是一个服务器的IP。

cnhnln 发表于 2003-7-4 23:56:29

/proc目录是个虚拟的目录。是你的内存中的当前内容

wuwe 发表于 2003-7-5 09:44:28

能不能问一个sdk的问题,我刚开始学这个。
如果所问超出本站的讨论范围,能不能给我几个讨论sdk编程的网站,最好像贵站
一样让我感觉良好,谢谢
问题:
什么时候会在窗口中出现无效区域;一个窗口被另一个窗口盖住时,被盖住部分是否为无效区域;接着当移开时windows 是不是会产生一个
进队的wm_paint,并计算出这个无效区域同时存入paintstruct中的rect域中
并重绘这个无效区域;无效区域是否要用BeginPaint使其成为有效区域

wuwe 发表于 2003-7-5 09:49:20

最后被星号夹住的两行代码让我头晕,能说明一下
吗?


/*----------------------------------------------------
   SYSMETS3.C -- System Metrics Display Program No. 3
               (c) Charles Petzold, 1998
----------------------------------------------------*/

#define WINVER 0x0500
#include <windows.h>
#include "sysmets.h"

LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                  PSTR szCmdLine, int iCmdShow)
{
   static TCHAR szAppName[] = TEXT ("SysMets3") ;
   HWND         hwnd ;
   MSG          msg ;
   WNDCLASS   wndclass ;
   
   wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
   wndclass.lpfnWndProc   = WndProc ;
   wndclass.cbClsExtra    = 0 ;
   wndclass.cbWndExtra    = 0 ;
   wndclass.hInstance   = hInstance ;
   wndclass.hIcon         = LoadIcon (NULL, IDI_APPLICATION) ;
   wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
   wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
   wndclass.lpszMenuName= NULL ;
   wndclass.lpszClassName = szAppName ;
   
   if (!RegisterClass (&wndclass))
   {
          MessageBox (NULL, TEXT ("Program requires Windows NT!"),
                      szAppName, MB_ICONERROR) ;
          return 0 ;
   }
   
   hwnd = CreateWindow (szAppName, TEXT ("Get System Metrics No. 3"),
                        WS_OVERLAPPEDWINDOW | WS_VSCROLL | WS_HSCROLL,
                        CW_USEDEFAULT, CW_USEDEFAULT,
                        CW_USEDEFAULT, CW_USEDEFAULT,
                        NULL, NULL, hInstance, NULL) ;
   
   ShowWindow (hwnd, iCmdShow) ;
   UpdateWindow (hwnd) ;
   
   while (GetMessage (&msg, NULL, 0, 0))
   {
          TranslateMessage (&msg) ;
          DispatchMessage (&msg) ;
   }
   return msg.wParam ;
}

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
   static intcxChar, cxCaps, cyChar, cxClient, cyClient, iMaxWidth ;
   HDC         hdc ;
   int         i, x, y, iVertPos, iHorzPos, iPaintBeg, iPaintEnd ;
   PAINTSTRUCT ps ;
   SCROLLINFOsi ;
   TCHAR       szBuffer ;
   TEXTMETRICtm ;
   
   switch (message)
   {
   case WM_CREATE:
          hdc = GetDC (hwnd) ;
         
          GetTextMetrics (hdc, &tm) ;
          cxChar = tm.tmAveCharWidth ;
          cxCaps = (tm.tmPitchAndFamily & 1 ? 3 : 2) * cxChar / 2 ;
          cyChar = tm.tmHeight + tm.tmExternalLeading ;
         
          ReleaseDC (hwnd, hdc) ;

               // Save the width of the three columns
         
          iMaxWidth = 40 * cxChar + 22 * cxCaps ;
          return 0 ;
         
   case WM_SIZE:
          cxClient = LOWORD (lParam) ;
          cyClient = HIWORD (lParam) ;

               // Set vertical scroll bar range and page size

          si.cbSize = sizeof (si) ;
          si.fMask= SIF_RANGE | SIF_PAGE ;
          si.nMin   = 0 ;
          si.nMax   = NUMLINES - 1 ;
          si.nPage= cyClient / cyChar ;
          SetScrollInfo (hwnd, SB_VERT, &si, TRUE) ;

               // Set horizontal scroll bar range and page size

          si.cbSize = sizeof (si) ;
          si.fMask= SIF_RANGE | SIF_PAGE ;
          si.nMin   = 0 ;
          si.nMax   = 2 + iMaxWidth / cxChar ;
          si.nPage= cxClient / cxChar ;
          SetScrollInfo (hwnd, SB_HORZ, &si, TRUE) ;
          return 0 ;
         
   case WM_VSCROLL:
               // Get all the vertial scroll bar information

          si.cbSize = sizeof (si) ;
          si.fMask= SIF_ALL ;
          GetScrollInfo (hwnd, SB_VERT, &si) ;

               // Save the position for comparison later on

          iVertPos = si.nPos ;

          switch (LOWORD (wParam))
          {
          case SB_TOP:
               si.nPos = si.nMin ;
               break ;
               
          case SB_BOTTOM:
               si.nPos = si.nMax ;
               break ;
               
          case SB_LINEUP:
               si.nPos -= 1 ;
               break ;
               
          case SB_LINEDOWN:
               si.nPos += 1 ;
               break ;
               
          case SB_PAGEUP:
               si.nPos -= si.nPage ;
               break ;
               
          case SB_PAGEDOWN:
               si.nPos += si.nPage ;
               break ;
               
          case SB_THUMBTRACK:
               si.nPos = si.nTrackPos ;
               break ;
               
          default:
               break ;         
          }
               // Set the position and then retrieve it.Due to adjustments
               //   by Windows it may not be the same as the value set.

          si.fMask = SIF_POS ;
          SetScrollInfo (hwnd, SB_VERT, &si, TRUE) ;
          GetScrollInfo (hwnd, SB_VERT, &si) ;

               // If the position has changed, scroll the window and update it

          if (si.nPos != iVertPos)
          {                  
               ScrollWindow (hwnd, 0, cyChar * (iVertPos - si.nPos),
                                 NULL, NULL) ;
               UpdateWindow (hwnd) ;
          }
          return 0 ;
         
   case WM_HSCROLL:
               // Get all the vertial scroll bar information

          si.cbSize = sizeof (si) ;
          si.fMask= SIF_ALL ;

               // Save the position for comparison later on

          GetScrollInfo (hwnd, SB_HORZ, &si) ;
          iHorzPos = si.nPos ;

          switch (LOWORD (wParam))
          {
          case SB_LINELEFT:
               si.nPos -= 1 ;
               break ;
               
          case SB_LINERIGHT:
               si.nPos += 1 ;
               break ;
               
          case SB_PAGELEFT:
               si.nPos -= si.nPage ;
               break ;
               
          case SB_PAGERIGHT:
               si.nPos += si.nPage ;
               break ;
               
          case SB_THUMBPOSITION:
               si.nPos = si.nTrackPos ;
               break ;
               
          default :
               break ;
          }
               // Set the position and then retrieve it.Due to adjustments
               //   by Windows it may not be the same as the value set.

          si.fMask = SIF_POS ;
          SetScrollInfo (hwnd, SB_HORZ, &si, TRUE) ;
          GetScrollInfo (hwnd, SB_HORZ, &si) ;
         
               // If the position has changed, scroll the window

          if (si.nPos != iHorzPos)
          {
               ScrollWindow (hwnd, cxChar * (iHorzPos - si.nPos), 0,
                           NULL, NULL) ;
          }
          return 0 ;

   case WM_PAINT :
          hdc = BeginPaint (hwnd, &ps) ;

               // Get vertical scroll bar position

          si.cbSize = sizeof (si) ;
          si.fMask= SIF_POS ;
          GetScrollInfo (hwnd, SB_VERT, &si) ;
          iVertPos = si.nPos ;

               // Get horizontal scroll bar position

          GetScrollInfo (hwnd, SB_HORZ, &si) ;
          iHorzPos = si.nPos ;

               // Find painting limits
************************************************************
          iPaintBeg = max (0, iVertPos + ps.rcPaint.top / cyChar) ;
          iPaintEnd = min (NUMLINES - 1,
                           iVertPos + ps.rcPaint.bottom / cyChar) ;
************************************************************         
          for (i = iPaintBeg ; i <= iPaintEnd ; i++)
          {
               x = cxChar * (1 - iHorzPos) ;
               y = cyChar * (i - iVertPos) ;
               
               TextOut (hdc, x, y,
                        sysmetrics.szLabel,
                        lstrlen (sysmetrics.szLabel)) ;
               
               TextOut (hdc, x + 22 * cxCaps, y,
                        sysmetrics.szDesc,
                        lstrlen (sysmetrics.szDesc)) ;
               
               SetTextAlign (hdc, TA_RIGHT | TA_TOP) ;
               
               TextOut (hdc, x + 22 * cxCaps + 40 * cxChar, y, szBuffer,
                        wsprintf (szBuffer, TEXT ("%5d"),
                           GetSystemMetrics (sysmetrics.iIndex))) ;
               
               SetTextAlign (hdc, TA_LEFT | TA_TOP) ;
          }

          EndPaint (hwnd, &ps) ;
          return 0 ;
         
   case WM_DESTROY :
          PostQuitMessage (0) ;
          return 0 ;
   }
   return DefWindowProc (hwnd, message, wParam, lParam) ;
}
页: [1]
查看完整版本: 网络配置问题