Solved

VB Winsock

Posted on 2001-08-23
15
225 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
 
LVL 69

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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now