Solved

VB Winsock

Posted on 2001-08-23
15
229 Views
Last Modified: 2013-11-13
I'm new to VB. I'd like to know how to simply login to a server with a username, and password. Any protocols would be of help.
Thx


I'm specifically refering to logging in to Yahoo! and
Keeping the connection open.
Sorry my original question was so vague.
0
Comment
Question by:Haxiom
  • 4
  • 3
  • 3
  • +5
15 Comments
 
LVL 28

Expert Comment

by:vinnyd79
ID: 6418306
what type of server do you want to login to?
0
 
LVL 1

Expert Comment

by:DandL
ID: 6418413
Yea you need to know what server you want to get into.  Almost all Servers have diffrent ways to login. If you give us a little idea of what you are wanting to do then we could point you in the right direction.  If you are just wanting to learn the basics of server communication then there are real world examples that we could give Like:

Writing a simple program that lets you hit a daytime server.

Or Sending a e-mail through a smpt server

What do you want to do?  If you are just wanting to learn about servers the best way is to play with telnet
0
 
LVL 2

Expert Comment

by:ramses
ID: 6418844
For FTP and HTTP, simply use the InternetOpen function of wininet.dll, then you can use all ftp and http functions you want

If it's just FTP you're after, please let me know, since I just finished developing an ocx that will allow you to open as much simultanious connections you like, and use the functions:

FTP_CD, FTP_RMDIR, FTP_MKDIR, FTP_GET, FTP_PUT, FTP_RENAME, FTP_DIR, and any other ftp function you would need.

If you want to program them yourself, visit the MSDN site and type "wininet.dll" in the search box.  You will then get a complete list of all functions suported by wininet.dll (both FTP, HTTP and GOPHER)

The function descriptions are ment for C programmers, but are easy converted to vb format

Example from MSDN Site for function FTPGetFile

Syntax

BOOL FtpGetFile(
    HINTERNET hConnect,
    LPCTSTR lpszRemoteFile,
    LPCTSTR lpszNewFile,
    BOOL fFailIfExists,
    DWORD dwFlagsAndAttributes,
    DWORD dwFlags,
    DWORD_PTR dwContext
);

Parameters

hConnect
 [in] description
lpszRemoteFile
 [in] descr...
lpszNewFile
 [in] descr...
fFailIfExists
 [in] descr...
dwFlagsAndAttributes
 [in] descr...
dwFlags
 [in] descr
dwContext
 [in] descr...

In VB, this translates to:

Declare Function FtpGetFile Lib "wininet.dll" Alias "FtpGetFileA" (ByVal hConnect As Long, ByVal remotefilename As String, ByVal localfilename As String, ByVal failifexists As Boolean, ByVal flagsandattributes As Long, ByVal dwflags As Long, ByVal context As Long) As Boolean


Variable type conversion:

Not all C types are available in Visual Basic, just use the following equivalents:

    HINTERNET --> LONG
    LPCTSTR --> STRING
    LPCTSTR --> STRING
    BOOL --> BOOLEAN
    DWORD --> LONG
    DWORD --> LONG
    DWORD_PTR --> LONG

Determine if you pass by value or by reference:

dwContext
 [in] descr...

This parameter is passed by value, the [in] C directive states just that

somevar
  [out] descr...
  [in, out] descr...

This paremeter is passed by reference.  This is the case in both [out] and [in, out] examples.

Furthermore, an * in a C type means 'a pointer to', so pass that variable by reference to, regardless of the [in] directive in the C description

For those interested, just send me a msg and I'll be more than happy to send you a typelib that you can use in VB with All FTP functions you need.  Or, if you wish, an home-made ocx for plug and ftp functionality

With kind regards

Ramses
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6419067
0
 
LVL 4

Expert Comment

by:PBuck
ID: 6419156
Go to this website and download the FREE SocketWrench control (http://www.catalyst.com/cgi-bin/download.cgi?product=wrench)

SocketWrench is a superb wrapper for winsock, plus until this last patch, winsock has been known to have memory leaks.  The install of this product provides some excellent full sample programs (such as FTP, SMTP, TCP/IP, even UDP) and includes the normal windows help files.

This will really kick start your programming skills with all sorts of PC communications.  These samples will provide all the login, download, upload information you will need!

Hope this helps!
0
 
LVL 1

Expert Comment

by:DandL
ID: 6420458
ramses, welcome to EE.  I think it would be more useful for the one whom asks a question if the question did not get locked until the question is clear. If you scroll to the bottom of the screen you will see this.

Comments
Comments are intended to be used as a collaboration tool. Many Experts choose to post
their solutions as comments only.

Answers
An answer is a specific solution to a question and should be submitted if it will solve the
questioner's problem and doesn't duplicate a previous comment.

Comment Vs. Answer
If you are unsure of your solution, post it as a comment. Members can accept comments
as solutions and award you Expert Points for them.




I think this community as a whole does not lock questions, so that the one who asks a question can get maximum bang for the points.
0
 

Expert Comment

by:ComTech
ID: 6420565
Hi DandL, thanks for the post, but I also explained it to Ramses in Community Support.

I think he will become a valuable player ing our community.

The question will now be rejected.

Thanks,
ComTech
Community Support
0
 

Expert Comment

by:ComTech
ID: 6420567
ramses the rejection does NOT take you out of the running, if you (now) comment, you will then receive the points.

ComTech

This question has been moved back to the Active Questions list.
0
 
LVL 1

Expert Comment

by:DandL
ID: 6421774
>I think he will become a valuable player ing our community.

 Yea I think your right. He seems to know his stuff.
0
 
LVL 2

Expert Comment

by:ramses
ID: 6421835
ok, I'll keep that in mind for other questions


RooOOOOAaar!
0
 

Expert Comment

by:ComTech
ID: 6422517
Go get'em ramses  :-)

CT
0
 
LVL 1

Expert Comment

by:DandL
ID: 6424119
>RooOOOOAaar!
>Go get'em ramses  :-)


<laugh>DandL</laugh>
0
 
LVL 2

Expert Comment

by:ramses
ID: 6431406
Haxom, go see the <PAQ> "Receive and Send Email from VB"

http://devx.experts-exchange.com/jsp/qManageQuestion.jsp?qid=20173019


Hope this helps




Ramses
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7202484
Hi Haxiom@devx,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Save as PAQ -- No Refund.
    *** I don't think there was a complete answer here.

Haxiom@devx, Please DO NOT accept this comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit.  Explain why.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 7216024
Per recommendation, points NOT refunded and question closed.

Netminder
CS Moderator
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Protecting vb6 & .Net code Obfuscation 18 181
Android development question 2 75
VBA: loop recent folder and copy txt file. 8 49
transition to visual .net from vb6 5 57
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question