<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=KOI8-R" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<tt>Hello Tomek.<br>
I think you forgot to link WinSock2 library </tt>Ws2_32.lib.<br>
<tt>I'll copypaste the MSDN page:<br>
<br>
</tt>
<h1>htons</h1>
<p>The <b>htons</b> function converts a <b>u_short</b> from host to
TCP/IP network byte order (which is big-endian).</p>
<pre class="syntax" xml:space="preserve"><b>u_short</b> <b>htons(</b>
<b>u_short</b> <i><a class="synParam" onclick="showTip(this)" href="">hostshort</a></i><b>
</b><b>);</b>
</pre>
<h4>Parameters</h4>
<dl>
<dt><i>hostshort</i> </dt>
<dd>[in] 16-bit number in host byte order. </dd>
</dl>
<h4>Return Values</h4>
The <a><b>htons</b></a> function returns the value in TCP/IP network
byte order.
<h4>Remarks</h4>
<p>The <b>htons</b> function takes a 16-bit number in host byte order
and returns a 16-bit number in network byte order used in TCP/IP
networks.</p>
<h4>Requirements</h4>
<p><b>Client: </b>Requires WindowsšXP, Windowsš2000 Professional,
Windows NT Workstation, WindowsšMe, Windowsš98, or Windowsš95.<br>
<b>Server: </b>Requires Windows Serverš2003, Windowsš2000 Server, or
Windows NT Server.<br>
<b>Header: </b>Declared in Winsock2.h.<br>
<b>Library: </b>Use Ws2_32.lib.<br>
</p>
<h4>See Also</h4>
<p><a href="winsock_reference.htm">Winsock Reference</a>, <a
href="winsock_functions.htm">Winsock Functions</a>, <a
href="htonl_2.htm"><b>htonl</b></a>, <a href="ntohl_2.htm"><b>ntohl</b></a>,
<a href="ntohs_2.htm"><b>ntohs</b></a>, <a href="wsahtonl_2.htm"><b>WSAHtonl</b></a>,
<a href="wsahtons_2.htm"><b>WSAHtons</b></a>, <a href="wsantohl_2.htm"><b>WSANtohl</b></a>,
<a href="wsantohs_2.htm"><b>WSANtohs</b></a></p>
<p><br>
<br>
</p>
<br>
Tomek Czerwinski wrote:
<blockquote cite="mid1231988424.20060503014938@tlen.pl" type="cite">
<pre wrap="">Hi!
Im just starting with WinPcap, so sorry, if it will be a nooby
question.
I use Microsoft Visual Studio 6.0 on WinXP. Today I tryied to run all
tutorials from the WinPcap site to see if anything goes wrong. Whole
code from lessons 1-5 works (compile+link+runs) just fine, but when
trying to link tutorial 6 i get such error:
Linking...
source.obj : error LNK2001: unresolved external symbol __imp__ntohs@4
Debug/Lekcja6.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Lekcja6.exe - 2 error(s), 0 warning(s)
On lines 193 and 194 i see that linker is haveing a problem with
function ntosh() and I dont have any idea why. I would be really
gratefull for any help!
And sorry for my english:> I havent slept for 3 days:/
_______________________________________________
Winpcap-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Winpcap-users@winpcap.org">Winpcap-users@winpcap.org</a>
<a class="moz-txt-link-freetext" href="https://www.winpcap.org/mailman/listinfo/winpcap-users">https://www.winpcap.org/mailman/listinfo/winpcap-users</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="80">--
Best regards. Vasily Borovyak <a class="moz-txt-link-rfc2396E" href="mailto:vbor@isd.dp.ua"><vbor@isd.dp.ua></a></pre>
</body>
</html>